Index Match to find a Value and return first row

roundaboutrc

New Member
Joined
Jul 24, 2019
Messages
5
Hello everyone,

Not sure if this is possible, but I think to think "All Things are Possible", so I figured I would ask. I have some data where the first column is category then every column after that is id's for that category.

ABCD
1Cat 1100012001450
2Cat 210021305
3Cat 32000
4Cat 4150318321900
5Cat 51235

<tbody>
</tbody>

I am looking for a formula to lookup an ID say in this case 1832 and return Cat 4, where the ID could be located anywhere from B1:D5. I have tried Index and Match [=Index(A1:A5,Match(1832,B1:D5,0))], but it doesn't like the B1:D5 it appears Match can only look at a single row or column.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
How about

Book1
ABCDEFG
1Cat 1100012001450
2Cat 2100213051832Cat 4
3Cat 32000
4Cat 4150318321900
5Cat 51235
Sheet2
Cell Formulas
RangeFormula
G2=INDEX(A1:A5,SUMPRODUCT((B1:D5=F2)*(ROW(B1:B5)))-ROW(B1:B5)+1)
 
Upvote 0
Not exactly sure why, but hopefully you can help. This works on the sample, but when I use it against the real data set of 7200 product IDs and 69 categories, the first 69 results is just a replication of categories.

Also I am getting some #Value!e rrors? How will this handle Product IDs that aren't found in the data set?N/A? Say 999 in the table below.


How about
ABCDEFG
1Cat 1100012001450
2Cat 2100213051832Cat 4
3Cat 32000
4Cat 4150318321900
5Cat 51235

<tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
G2=INDEX(A1:A5,SUMPRODUCT((B1:D5=F2)*(ROW(B1:B5)))-ROW(B1:B5)+1)

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Why you are getting errors I cannot say, but check that none of the data you are looking at contains errors.
However that formula will fail if you have duplicate IDs.
Try
=INDEX(A1:A5,SMALL(IF(B1:D5=F2,ROW(B1:D5)-ROW(B1)+1),1))

This is an array formula and needs to be confirmed with Ctrl Shift Enter
 
Upvote 0

Forum statistics

Threads
1,214,620
Messages
6,120,554
Members
448,970
Latest member
kennimack

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