Index function reference error

mdr8c

Board Regular
Joined
Feb 7, 2006
Messages
93
I'm trying to search an array for a specific value and then return all instances in the array.

=index(Sheet1!C48:D77,SMALL(IF(Sheet1!J48:J77="Gold",ROW(Sheet1!J48:J77)),ROW(1:1)),1)

If I use the following function it returns a value correctly.

SMALL(IF(Sheet1!J48:J77="Gold",ROW(Sheet1!J48:J77)),ROW(1:1))

However, when I embedded it into the index function it returns a reference error.

What do I have wrong, should I be using a different function?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
The row Function
ROW(Sheet1!J48:J77)
Is returning numbers from 48 to 77 (the row #s in the range)

The Row# in an INDEX function is not actually a Row # persay.
It's an index #, the nth cell in the referenced range.

So Index(A1:A10,3) = A3 (A3 is the 3rd cell in A1:A10)
BUT
Index(A5:A15,3) = A7 (A7 is the 3rd cell in A5:A15)

So if the smallest Row# that meets the criteria is 50,
Then the Index is trying to get the 50th cell in C48:C77
But there are only 30 cells in that range
So it is a #REF! Error


You can change the formula to
=index(Sheet1!C:C,SMALL(IF(Sheet1!J48:J77="Gold",ROW(Sheet1!J48:J77)),ROW(1:1)))
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top