Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get column names if column contains matching value (without VBA)

Given a named range Table1, how do I return all names from the array Table1[#Headers] where a matching input value exist in that column?

a b c
1 2 3
4 5 2
6 1 2

For the above sample data, I would like to return

search_value headers
1 a,b
2 b,c (or b,c,c)
3 c

With the above sample data, I can count the occurrences of a named search_value with the formula =SUM(--(Table1=search_value)). Given the existing True/False array from that formula, I’ve been trying to get relative cell mapping information. Sadly

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • XMATCH only evaluates on a 1-dimensional array
  • AGGREGATE is promising but I’ve so far been unable to evaluate CELL("address",{}) (or similar) such that it returns an array that I can use with AGGREGATE

The workbook in question is a shared workbook hosted in OneDrive so I’d like to avoid VBA if at all possible.

>Solution :

One way (with Office 365) would be:

=FILTER(Table1[#Headers],BYCOL(--ISNUMBER(MATCH(Table1,E2,0)),LAMBDA(x,MAX(x))))

where E2 is search value.
enter image description here

concatenated

Sorry – I just realized that you want a concatenated output:

=TEXTJOIN( ",", 1, FILTER(Table1[#Headers],BYCOL(--ISNUMBER(MATCH(Table1,E2,0)),LAMBDA(x,MAX(x)))) )

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading