Results 1 to 1 of 1

Thread: PQ - Comparing two columns in the same table and returning unmatched

  1. #1
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool PQ - Comparing two columns in the same table and returning unmatched

    (question from the web)
    Looking to find all the rows where column B does NOT match column A
    Source Result
    ColumnA ColumnB Data1 Data2 ColumnA NotMatchB Data1 Data2
    USNTS USNTS ABC
    123
    USNTS USSPZ ABC
    123
    USNTS USSPZ ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USNTS USLVV ABC
    123
    USLVV USNYC ABC
    123
    USMSY USMSY ABC
    123
    USHOU USHOU ABC
    123
    USMSY USMSY ABC
    123
    USMSY USMSY ABC
    123
    USLVV USNYC ABC
    123
    USNYC USNYC ABC
    123

    Code:
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Diff = Table.AddColumn(Source, "NotMatchB", each List.Difference({[ColumnB]},{[ColumnA]})),
        Expand = Table.ExpandListColumn(Diff, "NotMatchB"),
        Filter = Table.SelectRows(Expand, each ([NotMatchB] <> null)),
        TSC = Table.SelectColumns(Filter,{"ColumnA", "NotMatchB", "Data1", "Data2"})
    in
        TSC
    Last edited by sandy666; 02-16-2021 at 04:21 AM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

Similar Threads

  1. Automated Search Results Returning Nothing
    By Bill in forum Excel Help
    Replies: 8
    Last Post: 10-15-2020, 06:31 PM
  2. Improving Speed Comparing Multiple Columns
    By David Hill in forum Excel Help
    Replies: 6
    Last Post: 10-03-2013, 07:38 AM
  3. Replies: 4
    Last Post: 05-01-2013, 09:49 PM
  4. Replies: 4
    Last Post: 04-05-2013, 12:08 PM
  5. MLookup not returning results
    By jomili in forum Excel Help
    Replies: 5
    Last Post: 12-20-2012, 09:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •