How to Compare Two Columns in Excel (for matches & differences) (2024)

Watch Video – Compare two Columns in Excel for matches and differences

The one query that I get a lot is – ‘how to compare two columns in Excel?’.

This can be done in many different ways, and the method to use will depend on the data structure and what the user wants from it.

For example, you may want to compare two columns and find or highlight all the matching data points (that are in both the columns), or only the differences (where a data point is in one column and not in the other), etc.

Since I get asked about this so much, I decided to write this massive tutorial with an intent to cover most (if not all) possible scenarios.

If you find this useful, do pass it on to other Excel users.

This Tutorial Covers:

Note that the techniques to compare columns shown in this tutorial are not the only ones.

Based on your dataset, you may need to change or adjust the method. However, the basic principles would remain the same.

If you think there is something that can be added to this tutorial, let me know in the comments section

Compare Two Columns For Exact Row Match

This one is the simplest form of comparison. In this case, you need to do a row by row comparison and identify which rows have the same data and which ones does not.

Example: Compare Cells in the Same Row

Below is a data set where I need to check whether the name in column A is the same in column B or not.

How to Compare Two Columns in Excel (for matches & differences) (1)

If there is a match, I need the resultas “TRUE”, and if doesn’t match, then I need the result as “FALSE”.

The below formula would do this:

=A2=B2

How to Compare Two Columns in Excel (for matches & differences) (2)

Example: Compare Cells in the Same Row (using IF formula)

If you want to get a more descriptive result, you can use a simple IF formula to return “Match” when the names are the same and “Mismatch” when the names are different.

=IF(A2=B2,"Match","Mismatch")

How to Compare Two Columns in Excel (for matches & differences) (3)

Note: In case you want to make the comparison case sensitive, use the following IF formula:

=IF(EXACT(A2,B2),"Match","Mismatch")

With the above formula, ‘IBM’ and ‘ibm’ would be considered two different names and the above formula would return ‘Mismatch’.

Example: Highlight Rows with Matching Data

If you want to highlight the rows that have matching data (instead of getting the result in a separate column), you can do that by using Conditional Formatting.

Here are the steps to do this:

  1. Select the entire dataset.
  2. Click the ‘Home’ tab.How to Compare Two Columns in Excel (for matches & differences) (4)
  3. In the Styles group, click on the ‘Conditional Formatting’ option.How to Compare Two Columns in Excel (for matches & differences) (5)
  4. From the drop-down, click on ‘New Rule’.How to Compare Two Columns in Excel (for matches & differences) (6)
  5. In the ‘New Formatting Rule’ dialog box, click on the ‘Use a formula to determine which cells to format’.How to Compare Two Columns in Excel (for matches & differences) (7)
  6. In the formula field, enter the formula:=$A1=$B1How to Compare Two Columns in Excel (for matches & differences) (8)
  7. Click the Format button and specify the format you want to apply to the matching cells.How to Compare Two Columns in Excel (for matches & differences) (9)
  8. Click OK.

This will highlight all the cells where the names are the same in each row.

How to Compare Two Columns in Excel (for matches & differences) (10)

Compare Two Columns and Highlight Matches

If you want to compare two columns and highlight matching data, you can use the duplicate functionality in conditional formatting.

Note that this is different than what we have seen when comparing each row. In this case, we will not be doing a row by row comparison.

Example: Compare Two Columns and Highlight Matching Data

Often, you’ll get datasets where there are matches, but these may not be in the same row.

Something as shown below:

How to Compare Two Columns in Excel (for matches & differences) (11)

Note that the list in column A is bigger than the one in B. Also some names are there in both the lists, but not in the same row (such as IBM, Adobe, Walmart).

If you want to highlight all the matching company names, you can do that using conditional formatting.

Here are the steps to do this:

  1. Select the entire data set.
  2. Click the Home tab.
  3. In the Styles group, click on the ‘Conditional Formatting’ option.How to Compare Two Columns in Excel (for matches & differences) (12)
  4. Hover the cursor on the Highlight Cell Rules option.
  5. Click on Duplicate Values.How to Compare Two Columns in Excel (for matches & differences) (13)
  6. In the Duplicate Values dialog box, make sure ‘Duplicate’ is selected.How to Compare Two Columns in Excel (for matches & differences) (14)
  7. Specify the formatting.How to Compare Two Columns in Excel (for matches & differences) (15)
  8. Click OK.

The above steps would give you the result as shown below.

How to Compare Two Columns in Excel (for matches & differences) (16)

Note: Conditional Formatting duplicate rule is not case sensitive. So ‘Apple’ and ‘apple’ are considered the same and would be highlighted as duplicates.

Example: Compare Two Columns and Highlight Mismatched Data

In case you want to highlight the names which are present in one list and not the other, you can use the conditional formatting for this too.

  1. Select the entire data set.
  2. Click the Home tab.
  3. In the Styles group, click on the ‘Conditional Formatting’ option.How to Compare Two Columns in Excel (for matches & differences) (17)
  4. Hover the cursor on the Highlight Cell Rules option.
  5. Click on Duplicate Values.How to Compare Two Columns in Excel (for matches & differences) (18)
  6. In the Duplicate Values dialog box, make sure ‘Unique’ is selected.How to Compare Two Columns in Excel (for matches & differences) (19)
  7. Specify the formatting.How to Compare Two Columns in Excel (for matches & differences) (20)
  8. Click OK.

This will give you the result as shown below. It highlights all the cells that have a name that is notpresent on the other list.

How to Compare Two Columns in Excel (for matches & differences) (21)

Compare Two Columns and Find Missing Data Points

If you want to identify whether a data point from one list is present in the other list, you need to use the lookup formulas.

Suppose you have a dataset as shown below and you want to identify companies that are present in column A but not in Column B,

How to Compare Two Columns in Excel (for matches & differences) (22)

To do this, I can use the following VLOOKUP formula.

=ISERROR(VLOOKUP(A2,$B$2:$B$10,1,0))

This formula uses the VLOOKUP function to check whether a company name in A is present in column B or not. If it is present, it will return that name from column B, else it will return a #N/A error.

These names which return the #N/A error are the ones that are missing in Column B.

ISERROR function would return TRUE if there is the VLOOKUP result is an error and FALSE if it isn’t an error.

How to Compare Two Columns in Excel (for matches & differences) (23)

If you want to get a list of all the names where there is no match, you can filter the result column to get all cells with TRUE.

You can also use the MATCH function to do the same;

=NOT(ISNUMBER(MATCH(A2,$B$2:$B$10,0)))

Note: Personally, I prefer using the Match function (or the combination of INDEX/MATCH) instead of VLOOKUP. I find it more flexible and powerful. You can read the difference between Vlookup and Index/Match here.

Compare Two Columns and Pull the Matching Data

If you have two datasets and you want to compare items in one list to the other and fetch the matching data point, you need to use the lookup formulas.

Example: Pull the Matching Data (Exact)

For example, in the below list, I want to fetch the market valuation value for column 2. To do this, I need to look up that value in column 1 and then fetch the corresponding market valuation value.

How to Compare Two Columns in Excel (for matches & differences) (24)

Below is the formula that will do this:

=VLOOKUP(D2,$A$2:$B$14,2,0)

or

=INDEX($A$2:$B$14,MATCH(D2,$A$2:$A$14,0),2)

How to Compare Two Columns in Excel (for matches & differences) (25)

Example: Pull the Matching Data (Partial)

In case you get a dataset where there is a minor difference in the names in the two columns, using the above-shown lookup formulas is not going to work.

These lookup formulas need an exact match to give the right result. There is an approximate match option in VLOOKUP or MATCH function, but that can’t be used here.

Suppose you have the data set as shown below. Note that there are names that are not complete in Column 2 (such as JPMorgan instead of JPMorgan Chase and Exxon instead of ExxonMobil).

How to Compare Two Columns in Excel (for matches & differences) (26)

In such a case, you can use a partial lookup by using wildcard characters.

The following formula will give is the right result in this case:

=VLOOKUP("*"&D2&"*",$A$2:$B$14,2,0)

or

=INDEX($A$2:$B$14,MATCH("*"&D2&"*",$A$2:$A$14,0),2)

How to Compare Two Columns in Excel (for matches & differences) (27)

In the above example, the asterisk (*) is a wildcard character that can represent any number of characters. When the lookup value is flanked with it on both sides, any value in Column 1 which contains the lookup value in Column 2 would be considered as a match.

For example, *Exxon* would be a match for ExxonMobil (as * can represent any number of characters).

You May Also Like the Following Excel Tips & Tutorials:

  • How to Compare Two Excel Sheets (for differences)
  • How to Highlight Blank Cells in Excel.
  • How to Compare Text in Excel (Easy Formulas)
  • Highlight EVERY Other ROW in Excel.
  • Excel Advanced Filter: A Complete Guide with Examples.
  • Highlight Rows Based on a Cell Value in Excel
  • How to Compare Dates in Excel (Greater/Less Than, Mismatches)
How to Compare Two Columns in Excel (for matches & differences) (2024)

FAQs

How do you compare two columns in Excel and find matches? ›

In Excel, you can compare two columns using the IF condition. The formula to compare two columns is =IF(A2=B2,”Match”,” ”). It returns the result as Match against the rows that contain matching values, and the remaining rows are left empty.

How do I compare two lists in Excel to find matches? ›

Navigate to the "Home" option and select duplicate values in the toolbar. Next, navigate to Conditional Formatting in Excel Option. A new window will appear on the screen with options to select "Duplicate" and "Unique" values. You can compare the two columns with matching values or unique values.

Can you compare two Excel columns for differences? ›

To compare two columns in Excel for differences, replace the equals sign with the non-equality sign (<>). The formula is =IF(A2<>B2,”Match”,”Not a Match ”).

Can I use VLOOKUP to compare two columns? ›

Let's say you have two columns with some textual or numeric values and you need to identify which values are present in both columns and which aren't. The VLOOKUP function will help you complete this task.

How do I compare two Excel spreadsheets for matching data? ›

If you have two workbooks open in Excel that you want to compare, you can run Spreadsheet Compare by using the Compare Files command. If you don't see the Inquire tab in Excel, see Turn on the Inquire add-in. To learn more about the tools in the Inquire add-in, see What you can do with Spreadsheet Inquire.

How to statistically compare two sets of data in Excel? ›

To compare two Excel databases, you can utilize Conditional Formatting. Select the data range in the first database, go to Conditional Formatting > New Rule > Use a formula to determine which cells to format, and enter a formula like =A1<>B1. This will highlight differences between the two databases.

How to compare two sets of data? ›

One common approach is to use statistical tests to compare the distributions of different features in the two datasets. For example, you could use a t-test to compare the mean values of a particular feature in the two datasets or a chi-squared test to compare the proportions of different categories in the two datasets.

What is the formula for match in Excel? ›

The MATCH function searches for a specified item in a range of cells, and then returns the relative position of that item in the range. For example, if the range A1:A3 contains the values 5, 25, and 38, then the formula =MATCH(25,A1:A3,0) returns the number 2, because 25 is the second item in the range.

How do you find the difference between two cells in Excel? ›

Use cell references to calculate the difference

For example, if you stored the numbers “5” and “3” in the cells “A1” and “B2,” respectively, you could type “=A1-B2” into the formula bar. This also results in the number "2" appearing in your selected cell.

How to match data in two Excel sheets using VLOOKUP? ›

Rather than including the table array as you would for one sheet, you want to indicate the sheet range for the data. Here is what the formula might look like:VLOOKUP(lookup_value, Sheet_name! range, col_index_num, [range_lookup])You can define each of these components as: lookup_value: This is the value you search for.

How to compare two cells in Excel with text? ›

Re: Formula to compare text in 2 cells
  1. Using the IF and FIND functions: Excel. =IF(ISNUMBER(FIND(B2,A2)),TRUE,FALSE)
  2. Using the MATCH function (Excel 2016 and later): Excel. =IF(MATCH(B2,A2,0)>0,TRUE,FALSE)
  3. Using the SUMPRODUCT function with wildcards: Excel. =SUMPRODUCT(--(A2:A5*B2))>0.
Jan 22, 2024

How do you compare two lists in Excel for matches? ›

Use the formula “=IF(A1=B1, “Match”,”Not a match”)" to test if the cell in A1 is the same as B1, replacing the references to match your own data. Press the “Enter” key or select another cell to apply the formula. Identify whether your cell reads “Match” or “Not a match”, depending on the data in cells A1 and B1.

How to use VLOOKUP to find matches? ›

In its simplest form, the VLOOKUP function says: =VLOOKUP(What you want to look up, where you want to look for it, the column number in the range containing the value to return, return an Approximate or Exact match – indicated as 1/TRUE, or 0/FALSE).

Can VLOOKUP match 2 values? ›

You can't specify two lookup values in a VLOOKUP formula, so we'll need to use a workaround, which consists of two steps: Step1: Create a separate column where we will create unique lookup_values by merging our two lookup criteria – name and country – for example “MellaThailand“, “MellaNigeria“, etc.

How to compare data in two columns to find duplicates in Excel? ›

How to use Excel Conditional Formatting tool to find duplicate values between two lists
  1. Highlight the data that you wish to compare. (Tip: Don't include the headers.)
  2. Navigate to Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values:
  3. In the new window, select Duplicate and the desired color:
  4. Click OK.

How does xlookup work in Excel? ›

The XLOOKUP function searches a range or an array, and then returns the item corresponding to the first match it finds. If no match exists, then XLOOKUP can return the closest (approximate) match. *If omitted, XLOOKUP returns blank cells it finds in lookup_array.

References

Top Articles
Hurricane Ernesto makes landfall on Bermuda, will stir up dangerous beach conditions for East Coast this weekend | CNN
Live map: Track the path of Hurricane Ernesto
William G. Nolan - Baker Swan Funeral Home
Tripadvisor London Forum
Antonym For Proton
Faketoks Twitter
Al Horford House Brookline
Python Regex Space
Pizza Hut Order Online Near Me
Bg3 Fake Portrait Of A Noble Before His Death
Nizhoni Massage Gun
Bekijk hier het rouwregister van Uitvaartzorg FSK
Joann Ally Employee Portal
Soorten wolken - Weerbericht, weerhistorie, vakantieweer en veel weereducatie.
Domino Near
Her Triplet Alphas Chapter 32
BugBitten Jiggers: a painful infestation
Rick Harrison Daughter Ciana
Praxis für Psychotherapie und Coaching Rhein-Neckar
The Exorcist: Believer Showtimes Near Regal Waugh Chapel
Budokai Z Pre Alpha Trello
Express Pay Cspire
A Man Called Otto Showtimes Near Palm Desert
Numerous people shot in Kentucky near Interstate 75, officials say | CNN
Danae Marie Supercross Flash
Www.statefarm
Palindromic Sony Console For Short Crossword Clue 6 Letters: Composer Of
The Star Beacon Obituaries
Receive Sms Verification
Busted Paper Haysi Regional Jail
8 Farmhouse Classroom Essentials
Influencing Factors and Differences in Born Aggregometry in Specialized Hemostaseological Centers: Results of a Multicenter Laboratory Comparison
Cheeksorpillows
TV tablå Alla TV-program idag | Snabb och enkel tv-guide
Kare11.Com Contests
Myrtle Beach Armslist
Wlox Jail Docket
Theatervoorstellingen in Roosendaal, het complete aanbod.
SYSTEMAX Software Development - PaintTool SAI
Limestone Bank Hillview
Ruth Chris 3 Course Meal
Ny Lottery Second Chance App
Rubmd.com.louisville
Easy Homemade Eggnog is So Underrated
What Happened To Daniel From Rebecca Zamolo
Gelöst – Externe Festplatte kann nicht formatiert werden
600 Aviator Court Vandalia Oh 45377
Ultimate Guide to Los Alamos, CA: A Small Town Big On Flavor
Docagent Caesars Sign In
big island real estate - craigslist
Nfl Spotrac Transactions
NBA 2K: 10 Unpopular Opinions About The Games, According To Reddit
Latest Posts
Article information

Author: Manual Maggio

Last Updated:

Views: 6200

Rating: 4.9 / 5 (69 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Manual Maggio

Birthday: 1998-01-20

Address: 359 Kelvin Stream, Lake Eldonview, MT 33517-1242

Phone: +577037762465

Job: Product Hospitality Supervisor

Hobby: Gardening, Web surfing, Video gaming, Amateur radio, Flag Football, Reading, Table tennis

Introduction: My name is Manual Maggio, I am a thankful, tender, adventurous, delightful, fantastic, proud, graceful person who loves writing and wants to share my knowledge and understanding with you.