troubleshooting Question

# Using the Indirect() function in Excel asked on
Microsoft Excel
3 Comments1 Solution421 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
###### Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.