Compare Two Columns in Excel

How to Compare Two Columns in Excel? (Top 4 Methods)

Here we discuss the top 4 methods that are used to compare two columns in Excel –

  1. Method #1 – Compare Using Simple Formulae
  2. Method #2 – Compare Using IF Formula
  3. Method #3 – Compare using EXACT Formula
  4. Method #4 – Using Conditional Formatting

Let us now discuss each of the above methods in-depth with Examples

You can download this Compare Two Columns Excel Template here – Compare Two Columns Excel Template

#1 Compare Two Columns Data by Using Simple Formulae

We can compare two columns in excel by using one of the simple formulae. Assume you have two columns of data. The first column contains Log in Time, and the second column contains Log out Time.

Compare Two Columns Method 1

From the above data, we need to compare who forgot to log out from their shift. If the Log in Time is equal to Log out Time, then we can consider them as forgot to log out.

We can use a simple formula to do this task.

  1. Select the cell D2, then Open the equal sign and select the first cell as B2.

    Compare Two Columns Method 1-1

  2. Now again, enter the equal sign after B2 and select the cell C2.

    Compare Two Columns Method 1-2

  3. Once you hit enter, it will show either TRUE or FALSE. If the value in the cell B2 is equal to the value in the cell C2, it will show as TRUE, or else it will show as FALSE.

    Compare Two Columns Method 1-3

  4. Drag and drop the formula to the remaining cells to get the results.

    Compare Two Columns Method 1-4

    In the cells D5 and D9, we got the result as TRUE that means the value in the cell B5 is equal to C5.

#2 Compare Two Columns Data Using Excel IF Formula

In the previous example, we got the results as TRUE or FALSE. But we need the results as Forgot to Punchout if the employee forgot to log out. We need the results as No Problem if the employee logs out.

We can get the result as per our wish by using the IF function in excel.

Compare Two Columns Method 2

Okay, now we got the results as we wanted. Let me break down the formula to understand it better.

=IF (B2=C2, “Forgot to Punch Out”, “No Problem”)

If the condition tests whether the value in the cell B2 is equal to the value in the cell C2 if the result is TRUE, it will return the result as “Forgot to Punch-Out,” and the result is FALSE, it will return the result as “No Problem.”

#3 Compare Two Columns with Excel EXACT Formula

Take the same data for this example as well. I am going to apply an EXACT formula in excel to find the differences.

This formula also returns TRUE or FALSE as a result.

Compare Two Columns Method 3

Note: The EXACT formula is case sensitive. Look at the below formula I have applied for text values.

Compare Two Columns Method 3-1

In cell C2, we got the result as FALSE even though the value in the cell A2 and B2 are the same. Since there is an upper case value in the cell B2, it will show the result as FALSE.

In cell C3, we got the result as TRUE. Here the values in the cells A3 and B3 both are in the same case.

#4 Compare Two Columns in Excel Using Conditional Formatting

In the previous examples, we have learned how to compare two columns in Excel and identify the same values.

In this example, I am going to explain to you how to highlight or compare two excel columns if there is duplicate data using Conditional Formatting.

Take the same data from the above examples.

Compare Two Columns Method 4
  • Step 1: Select the entire data and go to the Home tab > Conditional Formatting > New Rule.
Compare Two Columns Method 4-1
  • Step 2: Once you click on New Rule, it will open the below dialogue box. Select Use a formula to determine which cells to format.
Method 4-2
  • Step 3: Apply the below formula is the formula section.
Method 4-3
  • Step 4: Once the formula is applied, click on Format > Go to Format. Select the color that you want to highlight and click on OK.
Method 4-4
  • Step 5: It highlights the same matched values.
Method 4-5

Okay, in this way, we can compare two columns in excel and find the deviations.

Things to Remember

  • There are several ways to compare two columns in excel. It depends on the data structure to apply which method is suitable.
  • Try to identify the differences using the IF condition. This would give the result as per our requirement.
  • If you are using the EXACT formula, you must keep in mind that it is a case-sensitive formula and highlight it as different if the data in the two cells are case sensitive.
  • Method 1 is the easiest way to compare 2 column values in excel.

Recommended Articles

This has been a guide to compare Two Columns in Excel. Here we discuss the top 4 methods to compare two columns in excel 1) Using Simple Formula, 2) IF formula, 3) Exact function, and 4) Conditional Formatting along with practical examples and a downloadable excel template. You may learn more about excel from the following articles –

  • 35+ Courses
  • 120+ Hours
  • Full Lifetime Access
  • Certificate of Completion