How to Compare Two Columns or Lists in Excel (4 Suitable Ways)

Method 1 – Compare Two Columns Using Equal Operator

Steps:

  • Add a new column on the right side to show the matching status.

  • Enter the following formula in Cell D5.
=B5=C5

Compare two columns using equal operator in Excel

  • Press Enter and drag the Fill Handle icon.

It will output True for match cases otherwise, False.


Method 2 – Use Row Differences Command of Go To Special Tool to Compare Two Lists in Excel

Steps:

  • Select the whole dataset of Range B5:C9.
  • Press the F5 button.

  • The Go To dialog box opens. Click on Special.

Go To dialog box in Excel

  • Select the Row differences option from the Go To Special window.
  • Press OK.

Compare two columns applying row differences technique in Excel

You can see two cells of the second column are selected.

  • Change the color of the cells from the Fill Color option.

  • Cells of the second column with mismatched data will be highlighted.

Change Color of different data cells after comparing two columns in Excel


Method 3 – Use Excel Functions to Compare Two Columns or Lists in Excel

3.1 Using IF Function

The IF function will compare the cells of the columns row-wise and check whether they are the same or not.

The IF function checks whether a condition is met, and returns one value if TRUE, and another value if FALSE.

Steps:

  • Enter the formula below in Cell D5.
=IF(B5=C5,"Match","Mismatch")

Compare two columns using Excel IF function

This formula will check whether the cells are the same or not. If same, it shows Match otherwise, Mismatch.

  • Drag the Fill Handle icon downwards.

The following formula is to compare for not matching values.

=IF(B5<>C5,"Mismatch","Match")

Compare two columns with difference condition

In this case, when the condition is True, it shows Mismatch, otherwise Match.


3.2 Applying EXACT Function

When you have the same data in two columns with case differences, use the EXACT function .

The EXACT function checks whether two text strings are exactly the same, and returns TRUE or FALSE. It is case-sensitive.

In Row 6, we have the same data from different cases. Enter the EXACT function to check the result.

Steps:

  • Insert the formula below in Cell D5.
=IF(EXACT(B5,C5),"Match","Mismatch")

Compare two columns using Excel EXACT function

The IF function is used to show the comment based on the decision taken by the EXACT function.

  • Drag the Fill Handle

We get the result as Mismatch.


3.3 Using MATCH Function

We will compare the 1st column with the 2nd column. When a match of the 1st column is found in the 2nd column, the result will be TRUE.

We will use the MATCH function with ISERROR and IF functions.

The MATCH function returns the relative position of an item in an array that matches a specified value with a specified order.

Steps:

  • Enter the following formula in Cell D5.
=IF(ISERROR(MATCH($B5,$C$5:$C$10,0)),"No match","Match found")

Compare Two Columns Using MATCH Function in Excel

When the statement is true result will be Match found otherwise No match.

  • Press Enter to execute the formula.

We got the result based on the 1st column. We are looking for a match in the 2nd column.

Read More: Excel formula to compare two columns and return a value


Method 4 – Compare Two Columns and Highlight Using Conditional Formatting

4.1 Highlight Equal Values in Two Columns

Steps:

  • Select the dataset.
  • Go to the Conditional Formatting option from the Home tab.
  • Choose New Rule from the dropdown.

Apply conditional formatting to compare two columns

  • The New Formatting Rule window will open.
  • Select Use a formula to determine which cells to format as the rule type.
  • Enter the following formula on the marked box.
=$B5=$C5 

Compare Two Columns Using Excel Conditional Formatting

  • Choose the Fill tab from the Format Cells window.
  • Choose the color.
  • Press OK.

 

  • Press OK.

Check the preview

Cells with the same data will be highlighted.

Highlighting Cells with similar data


4.2 Highlight Unique and Duplicate Cells

Steps:

  • Enter the New Rule option.

  • Select Format only unique or duplicate values rule type.
  • Choose the duplicate option.

Highlight duplicate data cells in Excel

  • Set the format color and press OK.

Duplicate cells are highlighted.

  • Follow the previous process and choose the unique option.

Highlight unique data cells in Excel

Duplicate and unique data care are highlighted in different colors.


Compare Two Columns in Excel and Count Matches

In this function, we will use the combination of the SUMPRODUCT function, and the COUNTIF function to count the matches. After that, we will calculate the number of total rows using the ROWS function and subtract the matches to get the number of mismatches.

The SUMPRODUCT function returns the sum of products of corresponding ranges or arrays.

Steps:

  • Add two rows. One for the match and another for the mismatch.

  • Insert the following formula based on the SUMPRODUCT and COUNTIF function in Cell C11.
=SUMPRODUCT(COUNTIF(B5:B9,C5:C9))

Compare Two Columns in Excel and Count Matches

  • Press Enter to get the result.

We get the number of matched rows.

  • Go to Cell C12 and enter the formula below.
=ROWS(B5:C9)-C11

Apply ROWS function to mismatches in Excel

  • PressEnter to get the number of mismatches.


Compare Two Columns in Excel and Remove Duplicates

Steps:

  • Select the dataset.
  • Go to the Conditional Formatting section.
  • Choose Duplicate Values from the Highlight Cells Rules.

  • Choose a color to indicate the duplicates.

Highlight duplicate data cells in Excel

  • The color of cells containing duplicate data has been changed.
  • Press Ctrl + Shift+ L to enable the filter option.

Enable filter in Excel

  • Click on the down arrow of the 2nd column.
  • Choose the color of the duplicate cells from the Filter by color section.

  • Only duplicate values are shown. Select that range.
  • Right-click on the mouse.
  • Choose the Clear Contents option from the Context Menu.

Compare Two Columns in Excel and Remove Duplicates

  • Duplicate values are removed from the dataset.

  • Go to the filter section and check the Select All option.

  • No duplicates are showing now.


Excel Match Two Columns and Extract Output from a Third with VLOOKUP

 

Steps:

  • Enter the following formula based on the VLOOKUP function on Cell F5.
  =VLOOKUP($E5,$B$5:$C$10,2,FALSE)

Excel VLOOKUP function to Compare two columns

  • It compares Item (S1) with Item (S2) and extracts the price in the 2nd table.


How to Compare More Than Two Columns in Excel

Method 1 – Use Excel AND Function

The AND function checks whether all arguments are TRUE, and returns TRUE if all arguments are TRUE.

After checking all the conditions, the result will be shown based on the comment used in the IF function. Before applying the formula, we add another column named Showroom 3.

Steps:

  • Enter the following formula on Cell E5.
=IF(AND(B5=C5,C5=D5),"Match","Mismatch")  

Compare more that two columns with Excel AND function

  • Drag the Fill Handle icon.


Method 2 – Compare with Excel COUNTIF Function

The COUNTIF function counts the number of cells within a range that meet the given condition, and  the COUNTA function counts the number of cells in a range that are not empty.[/wpsm_box]

We will use these functions to compare multiple columns.

Steps:

  • Enter the following formula on Cell E5.
=IF(COUNTIF(B5:D5,B5)=COUNTA(B5:D5),"Match","Mismatch")

Compare more than two columns with Excel COUNTIF function

  • Drag the Fill Handle icon.


Download Practice Workbook


<< Go Back to Columns | Compare | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Siam Hasan Khan
Siam Hasan Khan

Hello! Welcome to my Profile. Here I will be posting articles related to Microsoft Excel. I have completed my BSc in Electrical and Electronic Engineering from American International University-Bangladesh. I am a diligent, goal-oriented engineer with an immense thirst for knowledge and an attitude to grow continuously. Continuous improvement and life-long learning are my mottoes.

4 Comments
  1. Very informative and well described.

  2. Excellent! Thanks for this useful information.

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo