Skip a previously used cell

hannah2233

New Member
Joined
May 7, 2014
Messages
15
Hi Guys, I am trying to use vlookup (or match/index) to return a value in an array but if the number is repeated, the formula I am using always returns the first match it finds. I've put a simplified version of what I mean below:

1 Cat
1 Dog
2 Fish

In the first cell I am using =vlookup(1,$A$1:$B$3,2,False) which return "Cat", excellent!
But in the second cell I want to return 'Dog" but if I use the same formula it returns "Cat" again.
I need a formula, using the same array, which would ignore cat and return dog


Cheers,
Hannah xx
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Excel 2010
AB
11A
21B
31E
42R
52Q
63B
73L
84Z
9
101A
111B
121E
132R
142Q
154Z
Sheet22
Cell Formulas
RangeFormula
B10{=INDEX($B$1:$B$8,SMALL(IF($A$1:$A$8=A10,ROW($A$1:$A$8)),COUNTIF($A$10:A10,A10)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi thanks for your response, however it doesnt quite work correctly...
I used the example you provided and it is still returning the letter A, where I believe it should return B or E.

By looking up the value of 1, I need to return the name 'Cat' and another cell to pick up 'Pig" in the following example

1 Dog
1 Cat
2 Fish
1 Pig
5 Emu
0 Donkey

Thank you so much
Hannah
 
Upvote 0
It works on both examples when I try:


Excel 2010
AB
11Dog
21Cat
32Fish
41Pig
55Emu
60Donkey
7
81Dog
91Cat
102Fish
111Pig
125Emu
130Donkey
Sheet22 (2)
Cell Formulas
RangeFormula
B8{=INDEX($B$1:$B$6,SMALL(IF($A$1:$A$6=A8,ROW($A$1:$A$6)),COUNTIF($A$8:A8,A8)))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Thanks, it works when I use the columns A and B. but when I try insert a new row or shift the data it no longer functions correctly.
I have checked that the formula still samples the correct cells. This seems odd
 
Last edited:
Upvote 0
Sorry Just saw this....

I've just altered the spreadsheet so the values start in the first row, its non-ideal in terms of formatting and it will not be sensitive if I insert a row above row 1 but hey it works! In the working you provided try insert a row above and see if it still works, thats what the problem I was having.

Anyway I've found a work around, thank you so much
 
Upvote 0
In the working you provided try insert a row above and see if it still works, thats what the problem I was having.


Excel 2010
AB
1
21Dog
31Cat
42Fish
51Pig
65Emu
70Donkey
8
91Dog
101Cat
112Fish
121Pig
135Emu
140Donkey
Sheet15
Cell Formulas
RangeFormula
B9{=INDEX($B$2:$B$7,SMALL(IF($A$2:$A$7=A9,ROW($A$2:$A$7)-1),COUNTIF($A$9:A9,A9)))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Yes, you have to adjust the row function because it's returning a 7 when you only have six rows in the range (hence the REF error). Unlike the cell references that are automatically shifted.
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,366
Members
449,080
Latest member
Armadillos

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