Link to home
Start Free TrialLog in
Avatar of Steve_Brady
Steve_BradyFlag for United States of America

asked on

Using the Indirect() function in Excel

Hello,

In Excel (2007), I'm having trouble using the Indirect() function.  Can someone tell me how to tweak this formula so it does not bring up an error message?


Suppose that the listed cells contain the following values:

J2 = s,  K2 = 3
J3 = y,  K3 = 9

and I want to create a variable =COUNTIF range reference based on those four cells so that the values in those cells define the search range:

i.e. range = col (J2) & row (K2) : col (J3) & row (K3)

or for the values above,

=COUNTIF(S3:Y9,A1)


And for these values:

J2 = m,  K2 = 4
J3 = w,  K3 = 7

the range would be thus:

=COUNTIF(M4:W7,A1)

and so forth.


I assumed the following would do it:

=COUNTIF(INDIRECT(J2)&INDIRECT(K2):INDIRECT(J3)&INDIRECT(K3),A1)

but I'm obviously mistaken in that assumption.


What am I missing?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of MAdS
MAdS

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Steve_Brady

ASKER

2 good answers