INDEX MATCH to return a list based on a value

chappers

New Member
Joined
Nov 2, 2016
Messages
8
Ok, so ive two sheets. On sheet1 i want to enter a value which will then be queried in sheet2 and if matchning values are found then unique values be listed accordingly.

For example:

Sheet1 should look like this:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Search[/TD]
[TD]xyz[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Unique values[/TD]
[TD]bob[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD]john[/TD]
[/TR]
</tbody>[/TABLE]

Sheet 2

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]xyz.com[/TD]
[TD]bob[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]abc.com
[/TD]
[TD]matt[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]def.com[/TD]
[TD]bill[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]xyz.com[/TD]
[TD]john[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]def.com[/TD]
[TD]rick[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]abc.com[/TD]
[TD]adam[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]xyz.com[/TD]
[TD]john[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]xyz.com[/TD]
[TD]john[/TD]
[/TR]
</tbody>[/TABLE]

Ive tried the following formula in sheet1 but it doesn't return a list of unique values:

<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Lucida Grande'}span.s1 {color: #006107}span.s2 {color: #0057d6}</style>=INDEX(sheet2!B1:B6,MATCH("*"&B1&"*",sheet2!A1:A6,0))
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I'm hoping some more will pitch in ideas here, but I'll give you mine. Maybe my suggestion will work to your requirements or maybe it wont'.

Your sample sheets have me a little confused. Correct me if I'm wrong, but you are trying to search unique values that will be in column A to bring
information of that matching value from Column B correct?

It might seem a little too easy, but I would suggest a VLOOKUP formula. The sample Sheet 2 shows duplicate unique values with different matching values (xyz.com = bob or john, abc.com = matt or adam).
This sample in Sheet 2 is not unique as you described. If the list in Column A consists of truly unique values (xyz.com/hello135 or such), then a simple VLOOKUP formula for column index 2 will work.

Sheet 2 Cell B2 =VLOOKUP(sheet2CellA1, Sheet 1, 2, 0), double-click cell's bottom right corner to autofill formula down the entire list.
Lookup value = sheet2CellA1
Table array = Sheet 1, absolute reference ($A$1:$B$x)
Column index = 2 for second column of array
Range lookup = 0 for Exact Match, 1 for Approximate Match.
 
Upvote 0
This is an array formula that must be entered with CTRL-SHIFT-ENTER.
Drag formula down as needed.

Excel Workbook
AB
1Searchxyz
2
3Unique valuesbob
4john
5
Sheet 1
Excel Workbook
AB
1xyz.combob
2abc.commatt
3def.combill
4xyz.comjohn
5def.comrick
6abc.comadam
7xyz.comjohn
8xyz.comjohn
Sheet2
 
Upvote 0
Unforunately this didnt work:

{=IFERROR(INDEX(Sheet2!$B$1:$B$8,SMALL(IF(FREQUENCY(IF(ISNUMBER(SEARCH($B$1,Sheet2!$A$1:$A$8)),MATCH(Sheet2!$B$1:$B$8,Sheet2!$B$1:$B$8,0)),ROW(Sheet2!$B$1:$B$8)-ROW(Sheet2!$B$1)+1),ROW(Sheet2!$B$1:$B$8)-ROW(Sheet2!$B$1)+1),ROWS($B$3:B3))),"")}

Any ideas?
 
Upvote 0
How did it not work? Did you get an error msg. / did it return the wrong answer???
 
Upvote 0
Remove the IFERROR part of the formula, so you can see if you are getting an error.
Make sure to enter the formula with CTRL-SHIFT-ENTER (command-return on MAC).

Code:
[COLOR=#000000][FONT=Arial]=INDEX(Sheet2!$B$1:$B$8,SMALL(IF(FREQUENCY(IF(ISNUMBER(SEARCH($B$1,Sheet2!$A$1:$A$8)),MATCH(Sheet2!$B$1:$B$8,Sh    eet2!$B$1:$B$8,0)),ROW(Sheet2!$B$1:$B$8)-ROW(Sheet2!$B$1)+1),ROW(Sheet2!$B$1:$B$8)-ROW(Sheet2!$B$1)+1),ROWS($B$3:B3)))[/FONT][/COLOR]
 
Upvote 0
Sorry, got it working. There was a space in the formula so i just removed it:

{=IFERROR(INDEX(Sheet2!$B$1:$B$8,SMALL(IF(FREQUENCY(IF(ISNUMBER(SEARCH($B$1,Sheet2!$A$1:$A$8)),MATCH(Sheet2!$B$1:$B$8,Sh eet2!$B$1:$B$8,0)),ROW(Sheet2!$B$1:$B$8)-ROW(Sheet2!$B$1)+1),ROW(Sheet2!$B$1:$B$8)-ROW(Sheet2!$B$1)+1),ROWS($B$3:B3))),"")}
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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