Dec 14 2022 07:40 AM - edited Dec 14 2022 12:46 PM
I have a table of data. Each row/record has a unique identifier.
I have a separate list of unique identifiers that is a subset of those in the full table.
I want to see the data for only the records on my list.
All the data, i.e. every column, regardless of how many columns there are.
Here's an oversimplified example:
I have this table of data:
Column A | ColB | ColC | [...] | ColZ |
Christopher | dataB2 | dataC2 | [...] | dataZ2 |
Bob | dataB3 | dataC3 | [...] | dataZ3 |
Alice | dataB4 | dataC4 | [...] | dataZ4 |
David | dataB5 | dataC5 | [...] | dataZ5 |
Evelyn | dataB6 | dataC6 | [...] | dataZ6 |
I have this list:
David |
Bob |
Evelyn |
Desired end result is:
Column A | ColB | ColC | [...] | ColZ |
Bob | dataB3 | dataC3 | [...] | dataZ3 |
David | dataB5 | dataC5 | [...] | dataZ5 |
Evelyn | dataB6 | dataC6 | [...] | dataZ6 |
Except I need a couple hundred records out of a few thousand. Essentially, out of these zillions of records, show me only the ones on this list.
Current approach is manual brute force; add the target list as new rows to the original table, apply conditional formatting to that column to highlight those identifiers that are now duplicated, filtering that column on that format, and then filtering on a data column to exclude blank cells. Not particularly elegant.
Other hackey solutions we've come up with:
[Updated to add example / for clarity]
Dec 14 2022 12:18 PM
I'd add a helper column with formulas:
The formula in AA2 is =ISNUMBER(MATCH(A2,$A$9:$A$11,0)) where A9:A11 is the list of unique identifiers.
You can then filter for TRUE:
Dec 14 2022 12:22 PM
Dec 14 2022 12:50 PM
Would it be OK to return the filtered records to another range?
Dec 14 2022 12:57 PM
Dec 14 2022 01:03 PM
Dec 14 2022 01:13 PM
Also a good idea. Is there a way to allow a conditional statement like that dynamically adjust for a shorter or longer list?
A formula that relatively references each list item would solve that issue, but the best I can think of is a VLOOKUP, but that's just going to return one data value per record, when I want to get all of them.
Dec 14 2022 01:21 PM
An alternative could be Power Query. In the attached file you can add data in the large blue dynamic table. In the small blue dynamic table you can enter the names you want to filter. Then click in any cell of the green table and right-click with the mouse. Then select refresh.
The layout in the screenshot is for illustration. The small blue table and the green table can be dragged to columns AB and AD:BC for example. The large blue table can then be expanded to thousands of rows.
Dec 14 2022 01:24 PM
If you have Microsoft 365 or Office 2021, the formula would be
=FILTER(A2:Z6,ISNUMBER(MATCH(A2:A6,A9:A11,0)))
You only need to enter this in one cell; it will spill to as many rows and columns as needed.
Dec 14 2022 01:31 PM
Dec 14 2022 01:33 PM
Dec 14 2022 01:46 PM
Attached are the filter in place solutions. The TAKE workbook is for 365 and the OFFSET for legacy. Looks like you have some good options from everyone.
Dec 14 2022 01:48 PM
You are welcome. I have Excel 2013 and Power Query works with this version.
Dec 14 2022 04:59 PM
Dec 14 2022 05:09 PM