Comments on: How to compare two columns in Excel for matches and differences

The tutorial demonstrates a number of techniques to compare and match two or more columns in Excel with formulas, conditional formatting and the specialized wizard. Continue reading

Comments page 3. Total comments: 552

  1. Hello sir,
    I want to find this comparing two columns: If the email same in one column for two rows, the eligibility should be the same at another column. is there any formula finds the different ones (different eligibilities)? Thank you in advance

    1. Hello!
      Have you tried the ways described in this blog post? If they don’t work for you, then please describe your task in detail, I’ll try to suggest a solution.

  2. Hi sir

    master data "header in column A"

    FAN 250v
    HOUSING SS

    present data "header in column B"

    FAN, 25V
    HOUSING carbon steel

    I want to capture missing values and extra valves using "IF" function formula

    ex: first column missing value is 250V and extra value is 24V

    missing values to be extracted onto column C and extra values to be extracted column D

      1. Hi Sir,
        I want to compare data in column B1 to data in column A1 and what ever the missing part of data in column B1, i want it be entered in new column C1 and any extra data in column B1 compared to A1 i want it to be in new column D1

        A1 master data
        B1 worked data
        C1 missing data
        D1extra data

        for ex: columnA1 columnB1 column C1 column D1

        Fan 250V Fan 50V, 50 HZ 250V 50V,50HZ

        Here as shown above "Fan 250V" is master data and " Fan 50V, 50 HZ " is worked data, when we compare B1 with A1, 250V is missing in B1 so i want it to be entered in C1 as 250V and 50V, 50HZ is extra data in B1 compared to A1 so i want it to be entered in D1

        1. Hi!
          I'm really sorry, looks like this is not possible with the standard Excel options. The problem can be solved using a VBA macro.

        2. Hi sir,

          please consider this format

          input
          A1 master data: Fan 250V
          B1 worked data: Fan 50V, 50 HZ

          output
          C1 missing data: 250V
          D1 extra data: 50V,50HZ

          i want result like that output.....

  3. Hi
    I have data like this:

    Foreign Name Mobile Phone Telephone 2 Telephone 1
    38822 9873225232 9811991232 9811597655
    38823 9871955755
    38824 9818380011
    38825 9810086774
    38825 9987022284 8800596095 9810086774
    38826 9811090878
    38827 9312227934 9811126121 9811126121
    38828 9312664028
    38829 9811256883
    38829 9811550006

    Can you please help me to find all unique contacts from different columns for same Foreign Name.
    Note there are duplicates Foreign Name as well as duplicate contact numbers in a sheet.
    Waiting for the positive response....

  4. Hi Sir,
    I need your help, i want a formula of column A & B which match in cross pattern, eg- A2 moon has B2 Mercury & A4 Mercury has B4 Moon its Match,
    below i have shown the condition. its like X pattern .

    A B C
    SUN JUPITER
    MOON MERCURY match
    MARS SUN
    MERCURY MOON match
    JUPITER VENUS
    VENUS MARS
    SATURN SATURN

    Thanks

  5. I need a formula that will compare numbers in Column B on sheet 1 to numbers in column A in sheet 2 and if it finds a match return a value from column AD from sheet 2 to column A on sheet 1.

  6. Dear experts,
    I am looking for a formula to match two column values.

    Col 1 have 300,000 rows (contains numbers only)
    Col 2 have 220,000 rows (contains numbers only)

    I would like to compare first 800 column values with col2 (all the cell values) and print the matching values.

    Repeat the same for every 800 values(second one starts from 801 to 1600) in col1 and compare with all the col 2 values and display the matching values.

    Can we do this in one formula for every 800 values increments ?

    Expected Results:
    --------------------------
    Matching values for first 800 values : List all the matching values
    (increments of 800 every time)
    Matching values for 801-1600 values : List all the matching values

    please advise. Thanks in advance.

    Cheers,
    Jane

    1. Hello!
      To get a list of duplicates from two columns try this formula -

      =TEXTJOIN(", ",TRUE,UNIQUE(IFERROR(INDEX(A1:A800,IFERROR(MATCH(B1:B800,A1:A800,0),"")),"")))

      To concatenate all values into a string, use the TEXTJOIN function.

  7. Hello there!
    I have a sheet which contains code and product type as shown below.

    Code P.T.
    1.01 BCF
    1.01 BCF
    2.05 BCD
    2.03 BCF
    2.03 BCD

    I want to check which individual code have two or more similar product types or set of some specific product types, how can I do that. Also, Thanks in Advance.

  8. I have 30 days sheet. I just want to confirm if the same Name is repeated under the same cell like in J2. Is there any shortcut or formula to do the same?
    I tried this but not working

    ='1'!J1='2'!J1='3'!J1='4'!J1='5'!J1='6'!J1='7'!J1='8'!J1='9'!J1='10'!J1='11'!J1='12'!J1='13'!J1='14'!J1='15'!J1='16'!J1='17'!J1='18'!J1='19'!J1='20'!J1='21'!J1='22'!J1='23'!J1='24'!J1='25'!J1='26'!J1='27'!J1='28'!J1='29'!J1='30'!J1='31'!J1

    1. It's working with this.
      =IF(AND('1'!J1='2'!J1,'3'!J1='4'!J1,'5'!J1='6'!J1,'7'!J1='8'!J1,'9'!J1='10'!J1,'11'!J1='12'!J1,'13'!J1='14'!J1,'15'!J1='16'!J1,'17'!J1='18'!J1,'19'!J1='20'!J1,'21'!J1='22'!J1,'23'!J1='24'!J1,'25'!J1='26'!J1,'27'!J1='28'!J1,'29'!J1='30'!J1,'30'!J1='31'!J1),"Match", "")

  9. In my excel sheet, Column A is having names, Column B is having a Country name, Column C is having phone numbers, Column D is having a subject list and Column E is having status (Active or Inactive). How

    Can I create data with name, country, and status?

    I have to display the active students' names while I select the country.
    eg. If I select 'India', active students in India have to be displayed.

  10. Hello,

    I need to know if I can compare between two list columns and see the difference ( misses and similarities in between) the issue is that the data is not on the same order between the two columns but they are all the same type of data.

    Could you hap please.
    Thanks
    Sincerely yours.

  11. Hello. I need to compare two sets of numerical data (that have multiple equal entries) for differences, ie, if an amount may appear in one column four times, but only three times in the other column, or not at all. I need to see those differences. What would be the quickest way?

  12. I am trying to use the example under the section 'Compare two lists and highlight matches and differences' (Example 3. Highlight matches (duplicates) between 2 columns). Whilst i can get this to work okay, i was wondering if there was a way where if in list 1 there were 2 cells with the same value which match with a single cell in list 2, if it would be possible to only highlight one of the cells in list 1 rather than both, essentially leaving the other blank as it would not match any remaining numbers.

    For Example:

    List 1 List 2
    10 10
    10 20
    30 30

    In the above example I would want the first 10 in list 1 to match the 10 in list 2, and therefore highlight, leaving the second 10 in list 1 not highlighted. The 20 would not be highlighted of course, and the 30's would be highlighted as there is a straightforward match.

    Hopefully you can assist!

    1. Hello!
      Here are conditional formatting formulas that will highlight only straightforwards matches in columns A and C.

      =COUNTIF($C$2:$C$6, $A2)*(COUNTIF($A$2:A2, $A2) < = COUNTIF($C$2:$C$6, $A2))
      =COUNTIF($A$2:$A$6, $C2)*(COUNTIF($C$2:C2, $C2) < = COUNTIF($A$2:$A$6, $C2))

      I hope I answered your question.

  13. Hi how do i find out the total combinations of several numbers in a given column will be the numbers mentioned in another column ?

    Thanks in advance

  14. Hi. I have three columns of numerical data. Start score. Projected score. End Score. I want to highlight the growth or deficiencies between the columns. What would the formula be for something like that?

  15. Hi,
    I have two excel sheets: base stock values for parts, and how many parts are at a specific location. All parts have an assigned part number. Each sheet has three columns: part number(column a), description (column b), and a numeric value (column c). I need to compare the sheets based on part numbers and return the difference; how many of a part is needed to make base stock. Vlookup got me close, but the main issue is some parts have multiple part numbers and I'm not sure how to account for that. I need the parts with multiple part numbers to be grouped up and only return one value/difference for that group. Hope that makes sense. Have a slight feeling this has to be done in vba.

    Thanks for the help

    1. Hello!
      To find the sum of a group of parts, you can use the SUMIF function. The formula might look like this:

      =SUMIF(Sheet1!A2:A10,Sheet1!D1,Sheet1!C2:C10)-SUMIF(Sheet2!A2:A10,Sheet1!D1,Sheet2!C2:C10)
      Sheet1!D1 - part group.

      I hope my advice will help you solve your task.

  16. I have 8 columns. A, B, C, D, E, F, G, H.
    I have to find a match if Column A range value matches Column D range and Column B range value matches Column E value. e.g. A1...An = D1..Dn AND B1..Bn = E1..En then True else False.

    Thanks,
    Mohammad

    1. Hi!
      If I understand your task correctly, the following formula should work for you:

      =IF((SUM(--(A1=D1:D10)) > 0)*(SUM(--(B1=E1:E10)) > 0),TRUE)

      You can learn more about IF function with multiple conditions in Excel in this article on our blog.

  17. Hey Alexander, quick question I have two sheets both have names of students and their ID's. The issue is some names in one sheet are not present in the other so sheet 1 has names sheet 2 doesn't have and vice versa.

    Is there a way to maybe compare both data sets and get the differences? There has to be an easier way instead of manually going through each and every name on both sheets seeing the differences.

  18. How do I compare the numbers in column A to column B? There are 139 numbers listed in column A and I want to see if any of those numbers are in column B, which has 2399 numbers listed in it. What is the formula to do so?

    1. Hi!
      Have you tried the ways described in this blog post? If they don’t work for you, then please describe your task in detail, I’ll try to suggest a solution.

  19. Hi - thank you for the content.

    If I have a column containing duplicates and another column containing duplicates and non-duplicates in relation to the first column (but different values) - how do I find entries in the second column that are not duplicated in relation to the first?

    Example:

    COL1

    10491507PN
    10504180PR
    10600056PK
    10637712PW (dup)
    10637712PW (dup)
    10847773PE
    10862215PR
    10895567PF
    10931675P4
    10958992PO
    10968118P7 (dup)
    10968118P7 (dup)
    11383371PV
    11392084PW
    11650616PO

    COL2

    Comp
    Comp
    CompVV
    HomeCon (matches dup)
    HomeCon (matches dup)
    Comp
    Comp
    Comp
    Comp
    Comp
    TP (does not match dup)
    Comp (does not match dup)
    HomeCon
    HomeCon
    CompVV

    So in the above example I am aware 10637712PW is a duplicate. I need to also be aware the Col 2 has same values against that duplicate, eg HomeCon.

    I am also aware 10968118P7 is a duplicate and need to be aware that Col 2 has two different values against the duplicate, eg. TP and Comp.

    Please help?

      1. I figured out a way to solve this. Add two more columns, and in these, assign a number to all values in your second column, e.g. Comp is 42100 , CompVV is 42200, HomeCon is 42300 etc. You have to have two columns, with the same number in each. And use high values.

        Copy all the values from your original first column to a new sheet, remove duplicates, then with a COUNTIF formula count how many are there in your original first column of each. Then with a SUMIFS formula, sum the numbers in your first newly added column if they belong to a given value in your first original column. Then divide the result of these SUMIFS with the results of the COUNTIFS. Then lookup the numbers you get from this in your second added column. If they match, hooray, otherwise, there are different values assigned in your original second column to a value in your original first column.

        Hope this makes sense. It was much easier to do it then to explain it.

        1. This would be the end result using your values and my assigned numbers:

          10491507PN 1 42100 42100 42100
          10504180PR 1 42100 42100 42100
          10600056PK 1 42200 42200 42200
          10637712PW 2 84600 42300 42300
          10847773PE 1 42100 42100 42100
          10862215PR 1 42100 42100 42100
          10895567PF 1 42100 42100 42100
          10931675P4 1 42100 42100 42100
          10958992PO 1 42100 42100 42100
          10968118P7 2 84900 42450 #N/A
          11383371PV 1 42600 42600 42600
          11392084PW 1 42600 42600 42600
          11650616PO 1 42200 42200 42200

  20. if i have a value in A1 which i need to change to match value which is manually entered along the columns i.e if value is 10 and then 12 is entered into B1 i need A1 to match, and so on if 18 is entered into H1, A1 needs to change to 18

  21. Hello,
    I have a table with 50 columns and I want to create a new one who will display me if 2 or more values on the row are the same.
    Ex:

    No. C1 C2 C3 C4 C5 C6 N
    10 5 3 20 20 3 21 4
    11 7 2 7 3 1 7 3
    In my exemple N is the new column and it says to me that 4 ( C3 = C4 so 2 columns, C2 = C5 so another 2 columns, therefor 4 will be display) of the 6 column are matching with atleas one other column.

    Thank you !

      1. Yes, you did.

        But if I would want to have the duplicates shown how can I do it ?

  22. Hi,
    I need to count number of Sunday's he worked by referring empid from one sheet to another sheet.

    Information in sheet1 is emp I'd column and no. Of Sunday's to count in another column.

    Information in sheet 2 is list of emp IDs and worked on all weekdays in days.

  23. Hi,
    If I have older text in column A and newer text in column B for some Cells.
    How do I merge both with a logic saying:
    If there is no new text on column B, keep text of column A. If there is text on Column B, take text from column B.
    Thank you

  24. Here is my example:

    Column A Column B Column C
    2 Yes 5
    1 No
    10 Yes 8

    Is there a formula to state," If ColumnB=yes, then change ColumnA to ColumnC or if ColumnB=no, then do not change ColumnA

    TIA

  25. I have values in two different columns like below Example
    A b
    1 a
    2 b
    5 c
    6
    d

    How to compare and get output in C column on the condition If A have values, I want value of A in column C, If A don't have value I want value of B in Colum C, If column A,B are Empty C should be Empty)

    Expected output

    A b C
    1 a 1
    2 b 2
    5 c 5
    6 6
    d d

  26. Thanks a bunch! Needed to highlight differences in two columns.

  27. I have file as file as below

    A B C || D E F || G H I
    XYZ
    PQR
    MNO

    Now each of the columns A/B/C/D.... has some entries.
    I want to check for XYZ if value in A=D=G and B=E=H and C=F=I if all of this conditions are true then the value for XYZ should be true or else false.

    RIght now I am using And condition and comparing the cell values individually which is time consuming.
    Is there elegant way of doing it.

    Note: Here number of set of columns can be 2/3/4 or more with each set having 2 or more columns.

  28. What formula can I compare two list in column A & B from sheet 1 & sheet 2 and find exact matches?

  29. Hi

    I want to compare A1 to range of columns C1-C15 and B1 to range of columns D1- D15. If both conditions meet then i should return true. Please provide a way to resolve this

    Thanks
    Preetha

    1. Hello!
      If in each cell of the range C1: C15 the same values should be written equal to A1 —

      =IF(PRODUCT(--(C1:C15=A1))*PRODUCT(--(D1:D15=B1))>0,TRUE,"")

      If this is not what you wanted, please describe the problem in more detail.

  30. How to see the differences in two colums which have dates.. But the difference has to find with the dd only.

    Eg: 20210501 20210601 with this data the dd part is matching
    20210501 20210616 with this data dd part is not matching ( this is i need to find in a sheet)

  31. I have 2 excel sheets with 2 columns :
    Name of Item Values
    Want to compare "Name of Item" of 2 excels , and if same, compare "Values" .

    If values same , i want to create and populate with matching entries only.

    Thanks a lot in advance for help.

  32. How do I compare 3 columns and get the result one among them. Ex- Column A is having results Red, B is Orange and C is Green. I need a result Red.

  33. hello

    how to compare 2 columns and if they had the value we want, and count those matches?
    like
    A B
    1 2
    3 4
    1 2
    we want to count how many rows are there that A=1 AND B=2 ?

  34. Thanks so much!! This helped me a lot!

  35. Please ignore previous message. Consider this below message.

    Hi Hello,

    Table: 1
    Beg Page End Page Pg Count Date Type Title
    1 4 4 04/07/2021 06_Other Notice to Assessor
    5 8 4 09/02/2020 03_Investigations Police Report
    9 9 1 00/00/0000 07_Other Fax
    10 11 2 02/26/2021 06_Other Legal Correspondence
    12 18 7 02/26/2021 01_Forms Accident Benefits Form
    19 19 1 02/26/2021 06_Other Authorzation
    20 20 1 02/17/2021 01_Forms Caregiver Benefit Form
    21 21 1 00/00/0000 03_Investigations Accident Report
    22 22 1 01/21/2021 06_Other Correspondence
    23 24 2 01/19/2021 01_Forms Activities Form
    25 25 1 11/12/2020 06_Other Legal Correspondence

    Table: 2
    Beg Page End Page Pg Count Date Type Title
    1 4 4 04/07/2021 06_Other Notice to Assessor
    10 11 2 02/26/2021 06_Other Legal Correspodence
    12 18 7 02/26/2021 06_Other Accident Benefits Form
    19 19 1 02/26/2021 06_Other Authorization
    20 20 1 02/17/2021 01_Forms Authorization
    21 21 1 00/00/0000 03_Investigations Accident Report
    22 22 1 01/21/2021 06_Other Legal Correspondence
    23 24 2 01/19/2021 01_Forms Activities Form
    25 25 1 12/11/2020 03_Investigations Legal Correspondence

    Sir, How to compare Table1 vs Table2 as a result of missing sequence, date differences, type differences & Title differences?

  36. Hello all,
    thank you for this really helpful, have one question though.

    I need to compare two files with over 60k rows and columns from A to BD where only certain information was changed and the new file does not contain all rows as the original one. That means first vlookup and than match :/ is it somehow possible?

    Thank you for your help...

      1. Hello Alexander,

        Thank you so much for your reply and suggestions.

        Have a great day.

  37. How to compare each cell using vba.
    example as below
    Set 1 Set2 Match/ No match
    100 100 Match
    200 20 No Match
    300 300 Match

    800 800 Match
    400 0 No Match
    600 600 Match
    300 300 Match

  38. I have 2 columns. Column 1 has Name and surname and column 2 has full name with the surname. which formula would I use to see which names don't match?

    Eg
    Column 1 Column 2
    John Smith John William Smith
    Halley White Halley Brown

    1. Hello!
      Please try the following formula:

      =IF(COUNTIF(B2,"*"&SUBSTITUTE(A2," ","*")&"*")>0,"Match","Not match")

      I hope my advice will help you solve your task.

  39. the article is so helpful. thanks

  40. Thanks!

  41. Good morning,

    So first of all, thank you for this post. It helped me with most of what I need. I am missing one example which applies to my case. I am trying to see whether there are any matches in 5 columns where the value I am looking for is "Y". If "Y" is present in more than one of these columns, I want it to return as "Yes" and if not then "No". This is the formula I used: =IF(COUNTIF(J27:M27,I27)+COUNTIF(K27:M27,J27)+COUNTIF(L27:M27,K27)+(L27=M27)="Y","Yes","No")

    I am missing one small parameter though. I need to include the logic to that formula where H27 must also have a "N" value.....so it's all of the original formula AND H27 must also have a value of "N". Hopefully, I am making my question clear enough. It's looking for matches in columns I-M while having column H="N".

    Any help would be appreciated.

    Thank you

  42. Hi ,
    I am looking for a way to compare two columns of data where in the data is latitude and logitudes. The latitudes are in 9 char (alpha numeric) like N90 80 01 01 and Logitude is 10 char(alpha numeric) lik E111 54 50 89. I want to compare two cells of latitude or longitude to find whether the first 7 char of Latitude and first 8 chars of the longitude are matching. In other words i want to compare only the string of first 7 chars or first 8 chars in two columns.

    The examples dont talk about string match or am i missing something. Need help on this.

    1. Hello!
      To compare two columns for matches or differences in the same row use formula:

      =IF(LEFT(A2,7)=Left(B2,7),"Match","No match")

      To compare two columns in Excel for matches and differences —

      =IF(COUNTIF(B1:B10,LEFT(A1,7)&"*")>0,"Match","Not match")

      I hope my advice will help you solve your task.

  43. Thanks a lot, it saved me lot of time. Thanks again.

  44. Hi...
    May I know how to highlight whole row if Column B consists of "Apple" and Column C have the same items. Example below: I wish to highlight whole row of 01, 02, 03, 07, 08 & 09 as they have "Apple" and same item number. Thanks a lot

    01 Orange 123-789
    02 Pineapple 123-789
    03 Apple 123-789
    04 Grape 123-456
    05 Kiwi 123-456
    06 Orange 123-456
    07 Kiwi 123-968
    08 Pineapple 123-968
    09 Apple 123-968

  45. Uncle google answered me :)

    I have to change =SUM(E3:E21) to =SUM(VALUE(E3:E21)) to get the correct sum on the last column.

    Mystery solved !!!

  46. Hi,

    I want to make a sheet like pre-populated with answers.

    For examples;

    Each row has 5 columns (question number, option A, B, C, D), like below:

    Question # 1, has 4 options to pick - A, B, C or D. The correct answer is D.
    Question # 2, has 4 options to pick - A, B, C or D. The correct answer is B
    Question # 3, has 4 options to pick - A, B, C or D. The correct answer is A.

    Next, I want to run my answer through the same sheet without looking
    at the pre-populated answers.

    My answer like I pick:

    Question # 1, has 4 options to pick - A, B, C or D. My picked answer is A.
    Question # 2, has 4 options to pick - A, B, C or D. My picked answer is B.
    Question # 3, has 4 options to pick - A, B, C or D. My picked answer is C.

    At the end, I click on a button or macro, and show me nothing but saying
    either you passed (if the given answers are matching with pre-populated
    answers - 100%) or failed (showing % scored, i.e. 33.33% in the above case).

    Any help?

    Thanks

    1. I think, I made too complicated in my question. Just realized after posting, it can be much simplified.

      Each row has 3 columns (question number, pre-populated answer and my answer), like below:

      Question # 1, D, A
      Question # 2, B, B
      Question # 3, A, C

      At the end, I click on a button or macro, and show me nothing but saying either you passed (if the given answers are matching with pre-populated answers - 100%) or failed (showing % scored, i.e. 33.33% in the above case). Thanks!

      1. Almost there... with the exception of one thing :)

        Question # Correct Answer My Answer Result Marking
        1 A B FALSE 0
        2 C C TRUE 5
        3 C D FALSE 0

        Somehow, when I do sum on the last column, shows always 0 not 5. I have made last column as properties of it as number. It does not add and treating still somehow like: =IF(C3=B3, "5", "0") instead of its value like 0 or 5. This is where I am stuck now. Any help?

  47. Hi.

    I hope I can explain this clearly.

    What I am trying to do is compare two columns.
    1st column has dates dd-mmm-yyyy.
    2nd column has text. i.e. text1, text2, text3, text1...

    I would like to count how many times a particular text appears during one month i.e. January.

    Thanks.

  48. How can I compare specific digits within two columns? I am working with model numbers, so I need to compare the 8th and 9th digit of one column with the 9th and 10th digits of another column. The two digits in each column go together.

  49. Hello,
    Trying to see if it's possible to compare data in list 1 against data in list 2 and output the values that don't match in list 1 in another column.

    List 1 (these values are in a single cell, just separated by carriage returns)
    CN
    SA
    NS
    RO

    List 2 (single value in each row)
    CN
    NE
    NP
    RO

    Ideally, I'd like to have the formula in an adjacent column to list 1 and output the values that don't match up to any in list 2 that resides in a different sheet. In my example above, I would expect to see 'SA' and 'NS' as the output from the formula. Not sure if there is a function that can look through data as it's formatted in list 1.

  50. Hi, is it possible to do the one under "How to compare two columns in Excel for matches and differences" but for many columns instead of just comparing one column to a second column?

    Thanks

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)