While doing different tasks in Excel we often come across a situation where the matching and differences of two or multiple columns are required. It’s not a difficult task to compare two columns or lists in excel but you may get confused as there are so many ways to do it. In this article, we will look for different techniques for matching and differentiating columns in Excel.
Download Practice Workbook
Download this practice workbook to exercise while you are reading this article.
4 Methods to Compare Two Columns or Lists in Excel
We have a dataset of two columns. That columns contain names of items from two showrooms of a super shop. We will compare the data of these two showrooms.
1. Compare Two Columns Using Equal Operator
Here, we will compare two columns row-wise using the equal sign. When the items are the same indicate True otherwise False.
- Add a new column on the right side to show the matching status.
- Put the following formula on Cell D5.
- Now, press Enter and drag the Fill Handle icon.
We can see True appears for match cases otherwise, False.
Read More: How to Compare Two Columns and Return Common Values in Excel
2. Use Row Differences Command of Go To Special Tool to Compare Two Lists in Excel
In this method, we will use the Row differences technique. It compares those columns row-wise and selects the cells of the second column automatically.
- Select the whole dataset of Range B5:C9.
- Then, press the F5 button.
- The Go To dialog box appears. Click on the Special option.
- Now, select the Row differences option from the Go To Special window.
- Finally, press OK.
- We can see two cells of the second column are selected.
- We change the color of the cells from the Fill Color option.
- Look at the dataset now.
Cells of the second column with mismatched data are visible now.
Read More: Excel Compare Two Lists and Return Differences (4 Ways)
3. Use Excel Functions to Compare Two Columns or Lists in Excel
3.1 Using IF Function
Here, we will use the IF function. It will compare the cells of the columns row-wise and checks whether they are the same or not.
- We put a formula based on the IF function on Cell D5.
This formula will check whether the cells are the same or not. If same then, show Match otherwise, Mismatch.
- Now, drag the Fill Handle icon downwards.
You could use the following formula to compare for not matching values.
In this case, when the condition is True shows Mismatch, otherwise Match.
Read More: Excel Formula to Compare and Return Value from Two Columns
3.2 Applying EXACT Function
When we have the same data in two columns with case differences, we will use the EXACT function.
In Row 6, we have the same data from different cases. Now, apply the EXACT function to see whether it can detect the case difference or not.
- Insert the formula below on Cell D5.
Here, the IF function is used to show the comment based on the decision taken by the EXACT function.
- Pull the Fill Handle icon.
We get the result. Due to case difference Mismatch is showing at Cell D6.
3.3 Using MATCH Function
In this method, we will compare the 1st column with the 2nd column. When the matching of the 1st column is found on the 2nd column result will be TRUE.
Here, we will use the MATCH function with ISERROR and IF functions.
- Put the following formula on Cell D5.
=IF(ISERROR(MATCH($B5,$C$5:$C$10,0)),"No match","Match found")
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: How to Compare Two Columns in Excel for Match (8 ways)
4. Compare Two Columns and Highlight Using Conditional Formatting
In this section, we will use conditional formatting to compare two columns and highlight them according to conditions.
4.1 Highlight Equal Values in Two Columns
- Select the dataset first.
- Go to the Conditional Formatting option from the Home tab.
- Choose New Rule from the appeared dropdown.
- The New Formatting Rule window appears.
- Select Use a formula to determine which cells to format as the rule type.
- Put the following formula on the marked box.
- Choose the Fill tab from the Format Cells window.
- Choose the desired color.
- Press the OK button.
- We see the Preview here.
- Finally, press OK.
- Look at the dataset.
Cells with the same data are the highlight.
Read More: Macro to Compare Two Columns in Excel and Highlight Differences
4.2 Highlight Unique and Duplicate Cells
In this section, we will highlight the unique and duplicate data cells with different colors.
- Enter the New Rule option as shown previously.
- Select Format only unique or duplicate values rule type.
- Choose the duplicate option.
- Then, set the format color and press OK.
Duplicate cells are highlighted.
- Again, follow the previous process and choose the unique option.
- Have a final look at the dataset.
Duplicate and unique data care are highlighted differently.
Read More: Compare Two Columns in Excel and Highlight the Greater Value (4 Ways)
- How to Compare Multiple Columns Using VLOOKUP in Excel (5 Methods)
- Excel Compare Text in Two Columns (7 Fruitful Ways)
- How to Compare 4 Columns in Excel VLOOKUP (Easiest 7 Ways)
- Compare Three Columns in Excel and Return a Value(4 Ways)
- How to Compare 3 Columns for Matches in Excel (4 Methods)
Compare Two Columns in Excel and Count Matches
In this function, we will use the combination of the SUMPRODUCT, and COUNTIF functions 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.
- First, we add two rows. One for the match and another for the mismatch.
- Now, insert the following formula based on the SUMPRODUCT and COUNTIF function on Cell C11.
- Press the Enter button to get the result.
We get the number of matched rows.
- Now, go to Cell C12 and put the below formula.
- Again, press the Enter button to get the number of mismatches.
Read More: How to Count Matches in Two Columns in Excel (5 Easy Ways)
Compare Two Columns in Excel and Remove Duplicates
In this method, we will show how to remove the duplicates after comparing two columns.
- Select the dataset first.
- Go to the Conditional Formatting section.
- Choose Duplicate Values from the Highlight Cells Rules.
- Choose a color to indicate the duplicates.
- We can see the color of cells containing duplicate data has been changed.
- Now, press Ctrl + Shift+ L to enable filter option.
- 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 showing now. Select that range.
- Press the right button of the mouse.
- Choose the Clear Contents option from the Context Menu.
- Duplicate values are removed from the dataset.
- Again, 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
Here, we have two datasets. 1st one is of Showroom 1 and 2nd is of Showroom 2. We will compare item columns of each dataset and extract the price from Showroom 1 to Showroom 2 using the VLOOKUP function.
- Apply the formula based on the VLOOKUP function on Cell F5.
- After comparing Item (S1) with Item (S2), we extract the price in the 2nd table.
Read More: Match Two Columns and Output a Third in Excel (3 Quick Methods)
How to Compare More Than Two Columns in Excel
In the previous sections, we have shown a comparison between two columns. When we have more than two columns, we can use the below methods.
1. Use Excel AND Function
In this method, 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.
- Now, put the formula on Cell E5.
- After that, pull the Fill Handle icon.
Finally, we get the status.
Read More: How to Compare Two Columns in Excel for Missing Values (4 ways)
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]
Here, we will use these functions to compare multiple columns.
- Copy the following formula on Cell E5.
- Drag the Fill Handle icon.
Finally, we get the comparison result.
Read More: How to Compare 4 Columns in Excel (6 Methods)
In this article, we described how to compare two columns or lists in Excel. We compared the columns row-wise and column-wise in both ways. I hope this will satisfy your needs. Please have a look at our website ExcelDemy.com and give your suggestions in the comment box.
Very informative and well described.
Thanks, Farhana for the feedback.
Excellent! Thanks for this useful information.
Thanks. Glad to know that you found it useful.