Can VLOOKUP return multiple non-empty values from a table?

jeff_elbel

New Member
Joined
Jan 20, 2012
Messages
2
I have a table, created in Excel 2010 under Windows 7. The image of an example is below.
The table has a list of components down column A, one component per row.
The table has a list of products across the top row, one product per column.
If the component appears in a product, there is an X in the table. Otherwise, the table cel is empty.

Is there a way that I can do a VLOOKUP on the component value, and have Excel return the names of each product in which the component appears? That is, for a given component (row), I want to report every product (column) that contains a value of X (or non-empty cel).

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
I understand that this would require manipulation of the "col_index_num" field.

Thanks for any feedback! I have cross-posted to excelforum and techarena. Any helpful reply will be shared with due credit. I'll also mark these threads as solved once a solution can be described.

table_example.jpg
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
try this,

<b>Excel 2010</b><table cellpadding="2.5px" rules="all" style=";background-color: #FFFFFF;border: 1px solid;border-collapse: collapse; border-color: #BBB"><colgroup><col width="25px" style="background-color: #DAE7F5" /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup><thead><tr style=" background-color: #DAE7F5;text-align: center;color: #161120"><th></th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th><th>G</th><th>H</th></tr></thead><tbody><tr ><td style="color: #161120;text-align: center;">1</td><td style=";">Components</td><td style=";">Product1</td><td style=";">Product2</td><td style=";">Product3</td><td style=";">Product4</td><td style=";">Product5</td><td style=";">Product6</td><td style=";">Product7</td></tr><tr ><td style="color: #161120;text-align: center;">2</td><td style=";">Comp1</td><td style=";">x</td><td style=";">x</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">x</td></tr><tr ><td style="color: #161120;text-align: center;">3</td><td style=";">Comp2</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">4</td><td style=";">Comp3</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td></tr><tr ><td style="color: #161120;text-align: center;">5</td><td style=";">Comp4</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">6</td><td style=";">Comp5</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td><td style=";">x</td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">7</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">8</td><td style="background-color: #FFFF00;;">Components</td><td style="background-color: #9BBB59;;">Comp5</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">9</td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td><td style="text-align: right;;"></td></tr><tr ><td style="color: #161120;text-align: center;">10</td><td style="background-color: #FFFF00;;">Product</td><td style="background-color: #92D050;;">Product2</td><td style="background-color: #92D050;;">Product4</td><td style="background-color: #92D050;;">Product6</td><td style="background-color: #92D050;;"></td><td style="background-color: #92D050;;"></td><td style="background-color: #92D050;;"></td><td style="background-color: #92D050;;"></td></tr></tbody></table><p style="width:3.6em;font-weight:bold;margin:0;padding:0.2em 0.6em 0.2em 0.5em;border: 1px solid #BBB;border-top:none;text-align: center;background-color: #DAE7F5;color: #161120">Sheet2</p><br /><br /><table width="85%" cellpadding="2.5px" rules="all" style=";border: 2px solid black;border-collapse:collapse;padding: 0.4em;background-color: #FFFFFF" ><tr><td style="padding:6px" ><b>Worksheet Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: #FFFFFF;border-collapse: collapse; border-color: #BBB"><thead><tr style=" background-color: #DAE7F5;color: #161120"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: #DAE7F5;color: #161120">B10</th><td style="text-align:left">=IFERROR(<font color="Blue">INDEX(<font color="Red">$B$1:$H$1,AGGREGATE(<font color="Green">15,6,(<font color="Purple">COLUMN(<font color="Teal">$B$1:$H$1</font>)-MIN(<font color="Teal">COLUMN(<font color="#FF00FF">$B$1:$H$1</font>)</font>)+1</font>)/(<font color="Purple">(<font color="Teal">$A$2:$A$6=$B$8</font>)*(<font color="Teal">$B$2:$H$6="x"</font>)</font>),COLUMNS(<font color="Purple">$B9:B9</font>)</font>)</font>),""</font>)</td></tr></tbody></table></td></tr></table><br />
 
Upvote 0
Tremendous thanks to MrVillareal and NBVC! I'll study both of these solutions to learn from them. MrVillareal's solution is shown above. NBVC's solution appeared on excelforum thread:

=IFERROR(INDEX($B$1:$F$1,SMALL(IF(INDEX($B$2:$F$6,
MATCH($B$8,Component_List,0),0)="x",COLUMN($B$1:$F$1)-COLUMN($B$10)+1),
COLUMNS($B$1:B$1))),""

confirmed with CTRL+SHIFT+ENTER (not just ENTER), and copy across.

This thread is solved. Now, to learn how to MARK the thread solved. :) Thanks again for the education.
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,047
Members
449,206
Latest member
Healthydogs

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