Use match formula and exclude match from next search

nando88

Board Regular
Joined
Jun 22, 2013
Messages
124
I want to use a match formula to look for a value in a range of cells, but if there are repeated values, I would like to exclude the first match from the search, that way I don't use the value of the first match again.
I want to do this with a formula and without vba, if possible.
Thanks.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
This is kind of ugly, but it seems to work. I have the lookup value in O6 and the lookup range is in R6:R11. And the formula to give the relative position of the lookup value in the range is...

Code:
=IF(COUNTIF($R$6:$R$11,O6)>1,MATCH(O6,INDIRECT("R" & MATCH(O6,$R$6:$R$11,0) + ROW(R6) & ":R" & ROW(R11)),0)+MATCH(O6,$R$6:$R$11,0),MATCH(O6,$R$6:$R$11,0))

The countif sees if there is more than 1 of the lookup value in the lookup range. If yes, then it uses match with indirect, otherwise it does a regular match.
 
Upvote 0
This is kind of ugly, but it seems to work. I have the lookup value in O6 and the lookup range is in R6:R11. And the formula to give the relative position of the lookup value in the range is...

Code:
=IF(COUNTIF($R$6:$R$11,O6)>1,MATCH(O6,INDIRECT("R" & MATCH(O6,$R$6:$R$11,0) + ROW(R6) & ":R" & ROW(R11)),0)+MATCH(O6,$R$6:$R$11,0),MATCH(O6,$R$6:$R$11,0))

The countif sees if there is more than 1 of the lookup value in the lookup range. If yes, then it uses match with indirect, otherwise it does a regular match.

I just tried your answer, but it partially works.
It ignores the first value, but I need to find the first value and then ignore it and find the second.
Is this possible?
Thanks
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

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