Compare Comma-Separated Lists with an Excel Report Using Power Query
Question details
Compare letters listed in a comma-separated cell with letters on separate report rows for the same control number, and return a completeness indicator.

- Product
- Microsoft Excel Power Query
- Device & OS
- not provided
- Scenario
- One table contains a control number and a comma-separated list of expected letters; a second report contains one letter per row for each control number.
- Observed behavior
- The desired result is Yes when every expected letter appears in the report for its control number, and No when at least one is missing.
Make sure both sources have a control-number column and that the first source has a comma-separated letter list. Check that control numbers are stored consistently, especially if leading zeros matter.
Compare both tables and summarize missing letters in Power Query
Use a left outer merge to check every expected letter against the report, then count missing letters for each control number.
For these steps, name the control-number columns Control, the first table's list column LetterList, and the report's letter column Letter. The comparison checks whether expected letters are missing; extra letters in the report do not change the result.
Select each source range in Excel, choose Insert > Table, and then use Data > From Table/Range to open each table in Power Query.
In the first query, select LetterList and choose Home > Split Column > By Delimiter. Select Comma, open Advanced options, and choose Split into Rows. Rename the resulting column Letter.
Set Control and Letter to the Text data type in each query. Select each column and choose Transform > Format > Trim. Remove blank letter rows, and use Transform > Format > Uppercase on both Letter columns if letter case should not affect matching.
In the report query, select both Control and Letter, then choose Home > Remove Rows > Remove Duplicates. This prevents duplicate report rows from multiplying matches.
In the expected-letters query, choose Home > Merge Queries. Select the report query and select Control and then Letter in the same order in both tables. Choose Left Outer as the join type, then expand the merged column and select Letter with the column-name prefix enabled. Rename the expanded column Report.Letter if necessary.
Choose Add Column > Custom Column, name it Missing, and enter if [Report.Letter] = null then 1 else 0. Set Missing to Whole Number. To see the missing letters separately, right-click this query in the Queries pane, select Reference, and filter Missing to 1.
In the original merged query, choose Home > Group By. Group by Control and use the Sum operation on Missing, naming the result MissingCount. Choose Add Column > Custom Column and enter if [MissingCount] = 0 then "Yes" else "No". Select Home > Close & Load to return the results to Excel.

Work with Excel Reports in WPS Spreadsheet
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and move everyday report work to WPS, although it does not fix Microsoft Excel Power Query issues.

Frequently Asked Questions
How can I see which letters are missing?
In Power Query, right-click the merged query and select Reference. Filter the Missing column to 1 to display the control numbers and expected letters that did not match.
Why do matching letters appear as missing?
Check that Control and Letter use the same data types in both queries. Use Transform > Format > Trim to remove surrounding spaces, and apply Uppercase to both letter columns if case should be ignored.
Will an extra letter in the report make the result No?
No. The left outer merge checks whether each expected letter appears in the report. Extra report letters are not counted as missing.
How do I update the results after the reports change?
After updating the source tables, select Data > Refresh All in Excel to rerun the queries and update the loaded results.




