Help with Array formula for a complex lookup

Felice

New Member
Joined
Oct 24, 2013
Messages
1
I am trying to do a complex lookup and can't use vlookup because of the format of the data. I am trying to lookup ids (e.g. acc40402) from one list to determine their categories using a second list below. My lookup table: Col A is category and Col B is a comma separated list of accessories. I know that individually I can use the FIND() function to lookup the id in Cell B1 or B2.... what I want is to be able to look for an id in all of col B and return the corresponding value in col A for each row that id is found in. See my psuedo code below. I think it can be done with array formulas but I haven't figured out how yet.

logically what I want to do is

For each product id {
row = 0
For ( row = row + 1){
If (find (product id, B:row), A:row, 0);
}
}

The result can be an array/list of the values in col A for each of the ids used for lookup

Col A Col B
1 - Premium acc40402, acc40403, acc40404, acc40405, acc40406, acc40250, acc40407, acc40408, acc40252, acc40409, acc40410, acc40411, acc40412
2 - Advanced acc40414, acc40416, acc40417, acc40085, acc40418, acc40232, acc40117, acc40253, acc40083, acc40421, acc40422, acc40423, acc40424, acc40425
3 - Standard acc40399, acc40400, acc40401

<tbody>
</tbody>
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Maybe this:

Layout

1 - Premiumacc40402, acc40403, acc40404, acc40405, acc40406, acc40250, acc40407, acc40408, acc40252, acc40409, acc40410, acc40411, acc40412
2 - Advancedacc40402, acc40416, acc40417, acc40085, acc40418, acc40232, acc40117, acc40253, acc40083, acc40421, acc40422, acc40423, acc40424, acc40399
3 - Standardacc40399, acc40402, acc40401
*
acc403992 - Advanced3 - Standard
acc404021 - Premium2 - Advanced3 - Standard
************************************************

<colgroup><col width="67" style="width: 50pt; mso-width-source: userset; mso-width-alt: 2450;" span="4"> <tbody>
</tbody>


Array formula - use Ctrl+Shift+Enter and not only Enter to enter the formula

Code:
In B5

=IFERROR(INDEX($A$1:$A$3,
SMALL(IF(ISNUMBER(SEARCH(","&$A5&",",","&SUBSTITUTE($B$1:$B$3," ","")&",")),
ROW($A$1:$A$3)-ROW($A$1)+1),COLUMNS($B5:B5))),"")

Markmzz
 
Upvote 0

Forum statistics

Threads
1,215,373
Messages
6,124,545
Members
449,169
Latest member
mm424

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