+ Reply to Thread
Results 1 to 3 of 3

compare two columns and find differences

Hybrid View

  1. #1
    Registered User
    Join Date
    10-08-2016
    Location
    PAKISTAN
    MS-Off Ver
    OFFICE 2016
    Posts
    82

    compare two columns and find differences

    An excel sheet contained list of countries , in a column A only 55 names are listed whereas in a column B 98 names are listed, my task is to compare two columns and find those entries which are not in column B but not listed in column A and vise versa, excel sheet is attached herewith for reference.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: compare two columns and find differences

    Here is one option with Power Query

    let
        T1 = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Trimmed Text" = Table.TransformColumns(T1,{{"Column A", Text.Trim, type text}}),
        T2 = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
        #"Trimmed Text1" = Table.TransformColumns(T2,{{"Column B", Text.Trim, type text}}),
        MergeQueries = Table.NestedJoin(#"Trimmed Text", {"Column A"},#"Trimmed Text1", {"Column B"}, "Table2", JoinKind.FullOuter),
        #"Expanded Table2" = Table.ExpandTableColumn(MergeQueries, "Table2", {"Column B"}, {"Column B"})
    
    in
        #"Expanded Table2"
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,998

    Re: compare two columns and find differences

    E
    F
    1
    Country B not in A Country A not in B
    2
    Burkina algeria
    3
    Cameroon andora
    4
    czeia angola
    5
    Eagle Anguilla
    6
    Faso Antigua and Barbuda
    7
    flag Argentina
    8
    Good People Aruba
    9
    macedonia Bahamas
    10
    north Barbados
    11
    Usa Bottle
    12
    Brazil
    13
    Cherry
    14
    Chile
    15
    Costa Rica
    16
    croatia
    17
    Crow
    18
    CUBA FLAG
    19
    Curaçao
    20
    Dimension
    21
    Dont Stop
    22
    Dont stress
    23
    Flag 8
    24
    ghana
    25
    Ghost
    26
    GREENLAND
    27
    Grenada
    28
    Guadeloupe
    29
    Guyana
    30
    Honduras
    31
    I left my bed
    32
    kosovo
    33
    Legalize
    34
    malta
    35
    Martinique
    36
    morocco
    37
    Mozambique
    38
    Nicaragua
    39
    Niger
    40
    nigeria
    41
    north macedonia
    42
    PANAMA
    43
    Paws
    44
    Puerto Rico
    45
    Saint Kitts and Nevis
    46
    Saint Lucia
    47
    Saint Pierre and Miquelon
    48
    South africa
    49
    spain
    50
    sudan
    51
    Suriname
    52
    Trinidad and Tobago
    53
    Uruguay
    54
    Usa flag


    E2=IFERROR(INDEX($B$2:$B$56,AGGREGATE(15,6,ROW($B$2:$B$56)-ROW($B$2)+1/(ISNA(MATCH($B$2:$B$56,TRIM($A$2:$A$99),0))),ROWS($A$1:A1))),"")

    Copy down


    F2=IFERROR(INDEX($A$2:$A$99,AGGREGATE(15,6,ROW($A$2:$A$99)-ROW($A$2)+1/(ISNA(MATCH(TRIM($A$2:$A$99),$B$2:$B$56,0))),ROWS($A$1:A1))),"")

    Copy down

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. E-commerce , compare find out differences.
    By danielmedia73 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-06-2021, 07:51 PM
  2. [SOLVED] Compare of 2 tables & find the differences
    By Regina HR in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-20-2020, 06:49 AM
  3. [SOLVED] Compare differences in two columns
    By StreekyD in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 08-15-2018, 03:41 PM
  4. Replies: 2
    Last Post: 11-27-2016, 05:56 PM
  5. Compare 2 Columns - Find Differences
    By michaeljryan78 in forum Excel General
    Replies: 5
    Last Post: 07-23-2013, 10:43 AM
  6. Replies: 1
    Last Post: 07-12-2012, 05:43 AM
  7. [SOLVED] Compare two spreadsheets to find differences.
    By Toby in forum Excel General
    Replies: 2
    Last Post: 03-28-2005, 09:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1