0

I am trying to use the INDEX function to search an array for a value. However I would like that array range to be variable. However when I use the Address function to try and specify the range, I get an #value! error. For instance:

=INDEX($A$1:$B$2,1,2) Returns the value I want.

=ADDRESS(1,1,1,TRUE)&":"&ADDRESS(2,2,TRUE) Returns $A$1:$B$2

However =INDEX(ADDRESS(1,1,1,TRUE)&":"&ADDRESS(2,2,TRUE),1,2) returns #VALUE!

Any help is appreciated. This excel sheet is going to be in the hands of someone else so I'm trying to avoid using macros.

2
  • How is the array determined... if you give more details, we may be able to propose a better solution than using ADDRESS. Commented Jun 11, 2020 at 21:24
  • I haven't abandoned this thread, I'm just thinking about teylyn's answer. Commented Jun 11, 2020 at 22:18

1 Answer 1

1

Instead of Address, you can create a range with two Index functions

=INDEX($A:$Z,1,1):INDEX($A:$Z,2,2)

Wrap an Index around that

=index(INDEX($A:$Z,1,1):INDEX($A:$Z,2,2),1,2)

enter image description here

When you step through the formula with the Evaluate formula tool, you can see how the inner Index resolves into the range $A$1:$B$2.

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.