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 4. Total comments: 552

  1. 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 ?

  2. 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.

  3. 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

  4. 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

  5. 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

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

  7. 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.

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

  9. 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.

  10. 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)

  11. 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.

  12. 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.

  13. 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 ?

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

  15. 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?

  16. 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.

  17. 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

  18. 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.

  19. the article is so helpful. thanks

  20. Thanks!

  21. 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

  22. 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.

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

  24. 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

  25. 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 !!!

  26. 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?

  27. 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.

  28. 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.

  29. 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.

  30. 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

  31. how can i compare two lists having some spelling mismatch
    example
    column A column B
    Jemal Mohammed JAMAL MUHAMED
    Donald trump DANNALD TRAMP

    1. Hello!
      What result do you want after comparison?
      I'd recommend you to have a look at our Ultimate Suite for Excel - Ablebits Data - Duplicate Remover - Find Fuzzy Duplicates tool that can help you.
      It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.

  32. Hi, I need help to compare full years outstanding amount with the pre-set credit limit and find out the consecutive month which the outstanding amount had exceeded the credit limit. For example, we had set the credit limit for customer ABC for 5,050. I need to compare with the 12 months outstanding amount and find out 3 consecutive months which the outstanding amount is exceeded 5,050, thanks in advance.

  33. How can I detect repeating columns in that work sheet of 6000 columns with 5 rows.
    Thank you

  34. hello, thank you for this intuitive guide, but I hve a bootstrap samples of random numbers (1 through 5) generated using randbetween formula with 5 rows and 6000 columns, but I want to know how I can highlight the repeating columns in the 6000 columns using conditional format.
    I will be glad to hear from you.
    Thank you

  35. Hi

    What if there two cells with multiple text words within each separated by commas and I want to compare and highlight which of the words in thee two cells are a match or are different?

  36. Hi.
    I was just wondering...
    What formula should use to reconcile two columns of mixed invoice numbers in order to confirm their existence to both of columns.
    2. after the reconciliation to find their differences on their amounts which is the next column of each invoice. See below. Thank you

    A1232323 € 50.00 A1232323 € 50.00
    A1232324 € 55.00 A1232332 € 60.00
    A1232325 € 56.00 A1232333 € 65.00
    A1232326 € 57.00 A1232326 € 57.00

    1. Hello!
      How to compare two columns is described in detail in the manual above. If you have a problem, please specify which formula you mean and describe the problem in more detail. Thank you.

      1. Dear Alexander thank you for the response.
        I tried to read the article but still not find any formula matched.
        I will try to be more specific.
        Imagine that i am the company A and my creditor is company B.
        I have to reconcile the invoices has sent me until now if i had them too in my records.
        This is the first formula that i need to find from the two columns the same invoices and colour them.
        The second formula which that is the most important is to find the same invoices from the columns which are mixed and try to find if are they have any differences in their amounts and show me the difference if any.
        See the below example:

        Company A Amount Company B Amount Formula Formula

        ABC353536 € 56.00 ABC353538 € 65.00 ABC353536 € -
        ABC353537 € 58.00 ABC353536 € 56.00 ABC353537 -€ 2.00
        ABC353538 € 65.00 ABC353537 € 60.00 ABC353538 € -
        ABC353539 € 70.00 ABC353540 € 78.00 ABC353539 -€ 8.00
        ABC353539 € 75.00

        As you can see i am missing the invoice ABC353540 this one will be not coloured
        Also the invoices that they matched they are also been calculated if they have difference on their amount.

        1. Hello George!
          Use the condition formula to select the same accounts using conditional formatting

          =NOT(ISERROR(MATCH(A2,$C$2:$C$15,0)))

          To select the same accounts with the same amounts, use the formula

          =NOT(ISERROR(MATCH(A2&B2,$C$2:$C$15&$D$2:$D$15,0)))

          We have a ready-made formula-free solution for your task.
          We have a tool that can solve your task in a couple of clicks:

          Ablebits Data - Compare Tables

          This tool is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and use for 30 days for free: https://www.ablebits.com/files/get.php?addin=xl-suite&f=free-trial

          1. That's amazing!! I am very happy for using it. This is very helpful.
            One more thing. Could the second formula show the difference on amount instead of TRUE or False?

          2. Dear Alexander

            Thank you very much for your time.
            I will try it and give you the feedback :)

  37. Hi,
    I'd like to identify the current month is within a start and end date range. So for example I have a start Month of May and and end month of July. I'd like the formula to identify that the current month is within the range and return a yes.
    Thank you

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

      =IF(AND(MONTH(TODAY())>=MONTH(A1), MONTH(TODAY())<=MONTH(B1)),TRUE,FALSE)

      I hope it’ll be helpful.

    2. hope this also helps from a visual point of view
      Start Date || Due Date || Effort || Status || Priority || May || June || etc
      April || July. || H || Active.|| P1. || yes|| yes || etc

  38. Hi I have a slightly different query.

    Column A Column B
    1 1
    0 0
    1 0
    1 1
    1 0
    I want to count all those rows which have 1 in both columns. The output should be 2. Kinldy help me in putting the formula.

    1. Hello!
      If I got you right, the formula below will help you with your task

      =SUM((A:A=1)*(B:B=1))

      I hope this will help

  39. Hello,
    I have 2 excel with more than 500 row in both excel (peoples name)
    Since full names of peoples are not exactly same in both excel but for some name first name is matching and for some name, middle and last name is matching.
    so what formula can we use to find matching word between these 2 excel.
    thanks.

    1. Hello Shiv!
      Please describe your problem in more detail. Write an example of the source data and the result you want to get. It’ll help me understand it better and find a solution for you. Thank you.

      1. did you get a reply

  40. Hi,
    I have 2 columns: Column C - having all my dates when my customers require delivery and Column E – having all my dates when I will be finished. I want my dates in Column E to be GREEN if it is less than Column C and RED if it is greater than Column C. Can you assist with a formula or show me how, I’ve tried through conditional formatting and struggling, please assist.

  41. Hi

    I need to highlight duplicate values in column B where column A = 9 and repeat this process for A=8, A= 7 etc. Column A is a grade and column B is the rank for the grade (I.e if I have 4 grade 9’s, there should be ranks 1-4). I need to identify if there is duplicate ranks within each grade.

    Can you help please?

  42. Hello there,
    I have 30 questions (from Row 2 to 31 and Row 1 is header row). Column A is for question number, Column B is for correct answer, Column C is student 1 answer, Column D is student 2 answer and so on..
    I just want total correct answers for each student in row 32. I dont know if we can do anything with countif or sumif.. but what i did was, I added 1 column in the right for each student and then i put a simple formula if his/her answer matches with column B then 1 else 0, and the summing up in row 32.. is there any way to avoid those extra columns?

    1. Never mind.. i got my answer.. using sumproduct..

  43. Hi there,
    I need help, bellow here is the scenario.
    Column A = Client names
    Column B = Manager name
    Column C = Sign off date
    Identify any records where “Client Name” paired with “Manager name” has answer to “Sign off date” with dates that are not equal.

  44. I have an interesting problem. I am developing a project with 7 teams of 15 people on each team. One person may not be on more than one team. I want to find if I have put the same person on more than one team and highlight the name in both cells. I think it is a look for duplicates, but I cannot find a solution across 7 non-contiguous columns. Thank you so much for your help.

  45. NEED HELP.
    SCENARIO:
    CELL A1= 3/6/2020
    CELL B2= EMPTY
    CELL C3=+10 DAYS IF A1 HAS DATE, +10DAYS IF B2 HAS DATE AND A1 IS EMPTY, IF BOTH BLANKS IT RETURNS TO ZERO VALUE.
    WHAT IS THE FORMULA THIS SCENARIO?

    1. Hello Fred!
      If I understand your task correctly, the following formula should work for you:
      =IF(A1>0, 10,IF(B2>0, 10,0))

  46. What should i do if I am comparing tow columns with names, but the names dont match exactly.
    Example
    In Column A: Tom Jones
    In Column B: Thomas Jones
    when i do a vlookup, it would only match if they both were exact match. i want to show them as a match with my vlookup since they are the same people, what should i do?

  47. Hi I really like your blogs, but I just feel I have to sit down and learn this to understand all the fields etc. which is right now not so possible, I would appreciate if I can get a quick answer for my problem if there is a natural way or thru one of your tools to get this solved.
    I'm getting workbooks from my supplier containing info of items and pricing in divided several columns and this is continuously being updated, I would want an easy way to highlight single items of the list that had a price change, and if it went up or down, also adding the new items of the new list, and if there is missing items in the new list due to out of stock.
    Thank so much
    V.K.

  48. Hello .. I have a small pickle here :-).

    I have some data in sheet "XYZ" in Column A and some data in sheet "ABC" in Columns A and B.
    I need compare sheet "XYZ" Column A with sheet "ABC" column A and if there is a match on specific row, I need to move data from sheet "ABC" column B to sheet "XYZ" to column B.

    For exapmle:
    Sheet "XYZ" A3 has match with sheet "ABC" A7. So data from sheet "ABC" B7 will move to sheet "XYZ" B3.

    Hope I have described it correctly :-).
    I really appreciate you help!
    Standa

  49. Just wanted to say you are awesome! and thank you!

  50. COLUNN A COLUMN B COLUMN C
    APPLE 2 2.1
    APPLE 3 3.8
    CARROT 4 4
    RADISH 4 4
    I WANT TO TALLY ONLY APPLE 2 & APPLE 3 AS BOTH ARE SAME NAME AND IN COLUMN C IGNORE THE FRACTION SO APPLLE IS SAME IN COUMN B & COLUMN C IN FIRST & SECOND ROW . I WANT ONLY FIRST & SECOND ROW

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 :)