How to get multiple outputs from XLOOKUP?

mwl_y

New Member
Joined
May 23, 2024
Messages
17
Office Version
  1. 365
Platform
  1. Windows
This is a simplified version of what I need to do; to summarize the situation:
- I have a table with many columns (only 3 are relevant for now)
- Some of the rows may contain identical data in these columns (ex. the duplicate Shirt-Red-A)
- I need a single cell to contain the "Brands" that have items matching the Type and Colour criteria (in this case, the output I need would be "A, B")

1. I know I can use XLOOKUP to match multiple criteria, but it will only provide 1 output; is there a way to get all possible outputs from the XLOOKUP?
2. How would I then get rid of duplicate values? Is there a way to do that within the CONCAT function?

Thanks in advance!
1718147118886.png
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
To return multiple matching results, you would use FILTER, then wrap around UNIQUE to remove duplicates. Try:
Excel Formula:
=UNIQUE(FILTER(Table1[Brand],(Table1[Type]=H3)*(Table1[Colour]=H4)))

If you want to return all the results in a single comma-separated string, then add TEXTJOIN:
Excel Formula:
=TEXTJOIN(", ",,UNIQUE(FILTER(Table1[Brand],(Table1[Type]=H3)*(Table1[Colour]=H4))))
 
Upvote 1
Solution
To return multiple matching results, you would use FILTER, then wrap around UNIQUE to remove duplicates. Try:
Excel Formula:
=UNIQUE(FILTER(Table1[Brand],(Table1[Type]=H3)*(Table1[Colour]=H4)))

If you want to return all the results in a single comma-separated string, then add TEXTJOIN:
Excel Formula:
=TEXTJOIN(", ",,UNIQUE(FILTER(Table1[Brand],(Table1[Type]=H3)*(Table1[Colour]=H4))))
Wow, thank you! Didn't realize the code could be so short haha... this is perfect!
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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