Match a column in excel

MATCH function

Tip: Try using the new XMATCH function, an improved version of MATCH that works in any direction and returns exact matches by default, making it easier and more convenient to use than its predecessor.

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.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Tip: Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself. For example, you might use the MATCH function to provide a value for the row_num argument of the INDEX function.

Syntax

MATCH(lookup_value, lookup_array, [match_type])

The MATCH function syntax has the following arguments:

  • lookup_value    Required. The value that you want to match in lookup_array. For example, when you look up someone’s number in a telephone book, you are using the person’s name as the lookup value, but the telephone number is the value you want.

    The lookup_value argument can be a value (number, text, or logical value) or a cell reference to a number, text, or logical value.

  • lookup_array    Required. The range of cells being searched.

  • match_type    Optional. The number -1, 0, or 1. The match_type argument specifies how Excel matches lookup_value with values in lookup_array. The default value for this argument is 1.

    The following table describes how the function finds values based on the setting of the match_type argument.

Match_type

Behavior

1 or omitted

MATCH finds the largest value that is less than or equal to lookup_value. The values in the lookup_array argument must be placed in ascending order, for example: …-2, -1, 0, 1, 2, …, A-Z, FALSE, TRUE.

0

MATCH finds the first value that is exactly equal to lookup_value. The values in the lookup_array argument can be in any order.

-1

MATCH finds the smallest value that is greater than or equal tolookup_value. The values in the lookup_array argument must be placed in descending order, for example: TRUE, FALSE, Z-A, …2, 1, 0, -1, -2, …, and so on.

  • MATCH returns the position of the matched value within lookup_array, not the value itself. For example, MATCH(«b»,{«a»,»b»,»c«},0) returns 2, which is the relative position of «b» within the array {«a»,»b»,»c»}.

  • MATCH does not distinguish between uppercase and lowercase letters when matching text values.

  • If MATCH is unsuccessful in finding a match, it returns the #N/A error value.

  • If match_type is 0 and lookup_value is a text string, you can use the wildcard characters — the question mark (?) and asterisk (*) — in the lookup_value argument. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Product

Count

Bananas

25

Oranges

38

Apples

40

Pears

41

Formula

Description

Result

=MATCH(39,B2:B5,1)

Because there is not an exact match, the position of the next lowest value (38) in the range B2:B5 is returned.

2

=MATCH(41,B2:B5,0)

The position of the value 41 in the range B2:B5.

4

=MATCH(40,B2:B5,-1)

Returns an error because the values in the range B2:B5 are not in descending order.

#N/A

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

The MATCH function is used to determine the position of a value in a range or array. For example, in the screenshot above, the formula in cell E6 is configured to get the position of the value in cell D6. The MATCH function returns 5 because the lookup value («peach») is in the 5th position in the range B6:B14:

=MATCH(D6,B6:B14,0) // returns 5

The MATCH function can perform exact and approximate matches and supports wildcards (* ?) for partial matches. There are 3 separate match modes (set by the match_type argument), as described below. 

Note: the MATCH function will always return the first match. If you need to return the last match (reverse search) see the XMATCH function. If you want to return all matches, see the FILTER function.

MATCH only supports one-dimensional arrays or ranges, either vertical or horizontal. However, you can use MATCH to locate values in a two-dimensional range or table by giving MATCH the single column (or row) that contains the lookup value. You can even use MATCH twice in a single formula to find a matching row and column at the same time.

Frequently, the MATCH function is combined with the INDEX function to retrieve a value at a certain (matched) position. In other words, MATCH figures out the position, and INDEX returns the value at that position. For a detailed overview with simple examples, see How to use INDEX and MATCH.

Match type information

Match type is optional. If not provided, match_type defaults to 1 (exact or next smallest). When match_type is 1 or -1, it is sometimes referred to as an «approximate match». However, keep in mind that MATCH will always perform an exact match when possible, as noted in the table below:

Match type Behavior Details
1 Approximate MATCH finds the largest value less than or equal to the lookup value. The lookup array must be sorted in ascending order.
0 Exact MATCH finds the first value equal to the lookup value. The lookup array does not need to be sorted.
-1 Approximate MATCH finds the smallest value greater than or equal to the lookup value. The lookup array must be sorted in descending order.
(omitted) Approximate When match_type is omitted, it defaults to 1 with behavior as explained above.

Caution: Be sure to set match_type to zero (0) if you need an exact match. The default setting of 1 can cause MATCH to return results that look normal but are in fact incorrect. Explicitly providing a value for match_type, is a good reminder of what behavior is expected.

Exact match

When match_type is zero (0), MATCH performs an exact match only. In the example below, the formula in E3 is:

=MATCH(E2,B3:B11,0) // returns 4

Basic exact match with MATCH function

In the formula above, the lookup value comes from cell E2. If the lookup value is hardcoded into the formula, it must be enclosed in double quotes («»), since it is a text value:

=MATCH("Mars",B3:B11,0)

Note: MATCH is not case-sensitive, so «Mars» and «mars» will both return 4.

Approximate match

When match_type is set to 1, MATCH will perform an approximate match on values sorted A-Z, finding the largest value less than or equal to the lookup value. In the example shown below, the formula in E3 is:

=MATCH(E2,B3:B11,1) // returns 5

Basic approximate match with MATCH function

Wildcard match

When match_type is set to zero (0), MATCH can use wildcards. In the example shown below, the formula in E3 is:

=MATCH(E2,B3:B11,0) // returns 6

This is equivalent to:

=MATCH("pq*",B3:B11,0)

Basic wildcard match with MATCH function

INDEX and MATCH

The MATCH function is commonly used together with the INDEX function. The resulting formula is called «INDEX and MATCH».  For example, in the screen below, INDEX and MATCH are used to return the cost of a code entered in cell F4. The formula in F5 is:

=INDEX(C5:C12,MATCH(F4,B5:B12,0)) // returns 150

Basic INDEX and MATCH example

In this example, MATCH is set up to perform an exact match. The MATCH function locates the code ABX-075 and returns its position (7) directly to the INDEX function as the row number. The INDEX function then returns the 7th value from the range C5:C12 as a final result. The formula is solved like this:

=INDEX(C5:C12,MATCH(F4,B5:B12,0))
=INDEX(C5:C12,7)
=150

See below for more examples of the MATCH function. For an overview of how to use INDEX and MATCH with many examples, see:  How to use INDEX and MATCH.

Case-sensitive match

The MATCH function is not case-sensitive. However, MATCH can be configured to perform a case-sensitive match when combined with the EXACT function in a generic formula like this:

=MATCH(TRUE,EXACT(lookup_value,array),0))

The EXACT function compares every value in array with the lookup_value in a case-sensitive manner. This formula is explained with an INDEX and MATCH example here.

Notes

  • MATCH is not case-sensitive.
  • MATCH returns the #N/A error if no match is found.
  • MATCH only works with text up to 255 characters in length.
  • In case of duplicates, MATCH returns the first match.
  • If match_type is -1 or 1, the lookup_array must be sorted as noted above.
  • If match_type is 0, the lookup_value can contain the wildcards.
  • The MATCH function is frequently used together with the INDEX function.

matching columns in excel

Matching Columns in Excel (Table of Contents)

  • Introduction to Matching Columns in Excel
  • How to Match Columns in Excel?

Introduction to Matching Columns in Excel

Many a time in Excel, we have to compare two columns. There are different techniques for that. We can use functions like IF, COUNTIFS, Match, and conditional formatting. We can find the matching data in both the columns as well as the different ones.

There are various examples of matching columns with different functions. Using any of them as per the requirement will give you matching data in two or more columns.

Comparing Two Columns Row by Row

This is one of the basic comparisons of data in two columns. In this, the data is compared row by row to find the matching and difference in data.

How to Match Columns in Excel?

Matching Columns in Excel is very simple and easy. Let’s understand how to use the Matching Columns in Excel with some examples.

You can download this Matching Columns Excel Template here – Matching Columns Excel Template

Example #1 – Comparing Cells in Two Columns

Let’s compare cells in two columns that are in the same row. Below we have a table with two columns that have some data, which can be the same or different. We can find out the similarity and the differences in data as shown below.

matching column in excel example 1-1

Now we will type =A2=B2 in cell C2.

matching column in excel example 1-2

After using the formula result shown below in cell C2.

matching column in excel example 1-3

And then drag it downwards to get the result.

matching column 1

Matching cells are giving “True” and different ones “False”.

Example #2 – Comparing Two Cells in the Same Row

Let’s compare two cells in the same row using the IF function.

matching column in excel example 2-1

Using our above data table, we can write the IF formula in cell C2.

matching column in excel example 2-2

After using the IF Formula, the result shown below.

matching column in excel example 2-4

Drag the same formula in cell C2 to cell C11.

matching column 2

The matching cells yielded a result as a match, and the unmatched are indicated as blank.

matching column in excel example 2-5

Another way to indicate cells can be done in the below manner. We will write the below formula in cell C2.

mismatch formula

This will indicate the matching cells as “Match”, and different cells as “Mismatch”.

matching column 3

We can also compare case sensitive data in two columns in the same row.

Example #3 – Finding the Case Sensitive Match

To go for a case sensitive match, we use the EXACT function. We have sample data to find case sensitive match.

matching example 3-1

In cell C2, we will write the formula as below.

matching example 3-2

After using the IF, the formula result is shown below.

matching example 3-3

Drag the same formula in cell C2 to cell C6.

matching column 4

After writing the formula in cell c2, drag it downwards to see the case sensitive match of cells in the same row.

Highlighting Row Difference in Two Columns

To highlight the cell in the second column that is different from the first in the below data table.

matching example 4-1

Select both the columns, then go to the “Find & Select” tab and then go to “Go to Special..”

matching example 4-2

Now select ‘Row differences.’

matching example 4-3

Press Enter Key. You will now see the unmatched cells highlighted.

matching example 4-4

Example #4 – Comparing More than 2 Different Columns

In this example, let’s compare more than 2 different columns for the match in the same row. In the below data table, we have to match all three columns in the same row and show the result in column D.

matching example 5-1

We will write the below formula in cell D3.

matching example 5-2

After using the formula, the result is shown below.

matching example 5-3

Drag the same formula in other cells.

match example 4

We can see that column A, B and C have the same data in row 3, 4,6,7 and 8, and so the result is “match” while the data is different in other rows.

Example #5 – Finding Matching Cells in the Same Row

Now we will find out the matching cells in the same row but only in 2 columns using the OR function.

matching example 6-1

Taking our previous data table, we will write the below formula using the OR function in cell D2.

matching example 6-2

Press Enter, then drag it downwards.

matching example 6-3

We can see that any two columns that have the same data are a match.

Example #6 – Compare Two Columns to Find Matches and Differences

We have data in two columns, and we want to find out all the text, strings, or numbers in column A but not in column B.

This way, we will compare the two columns and find out the matching value and the different ones. Below we have a sample data in which we will compare column A and column B to find the matching data.

matching example 7-1

To get the desired result, we will write this formula in cell C2.

 matching example 7-2

We will write the formula and press Enter, and then drag it downwards to see the result. In the below formula, we have used COUNTIF with IF. The COUNTIF formula searches A1, then A2, and so on in column B, and IF gives it a condition that if there will be 0, then it will return “No match”, and if the value returned by COUNTIF is 1, it will be a match.

matching example 7-3

In the above example, the COUNTIF function searched A1 in column B, then A2 in column B, then C1 in column B and so on till it finds the value in A, and so it returns “match”.

match example 7-4

We can also get the same result by using the Match function.

match example 7-5

Now drag it downwards.

match example 7-8

We get the same result with this formula as well.

Example #7 – Compare Two Columns and Highlight the Matches and Differences

We can compare and highlight the entries in column A that are found in Column B by using Conditional Formatting.

match examples 8-1

Select the column in which you want to highlight the cells. Then click Conditional Formatting Tab and then “use a formula to determine which cells to format”.

match examples 8-2

Click on OK.

match examples 8-3

Cells that are matching in both the columns are highlighted. In the same way, we can highlight the cells that are not matching.

Select the column in which you want the cells that are different from being highlighted.

match examples 8-4

Now click on OK.

match examples 8-5

All the cells of column 1 that are not found in column 2 are highlighted.

The above examples are some of the ways to compare two columns. Going through the above examples, we can find out the matches and differences in two or more columns.

Things to Remember About Matching Columns in Excel

  • We can compare the data in two or more columns that are in the same row.
  • Both the columns should be of the same size.
  • If any of the cells are left blank, the result will be blank.
  • This is a case sensitive thing. The same data in different cases will lead to an unmatched result. To compare case sensitive data and get a correct result use the exact function.

Recommended Articles

This is a guide to Matching Columns in Excel. Here we discuss How to use Matching Columns in Excel along with practical examples and a downloadable excel template. You can also go through our other suggested articles –

  1. Compare Two Columns in Excel for Matches
  2. Excel Match Function
  3. COLUMNS Formula in Excel
  4. Excel Match Multiple Criteria

The MATCH function looks for a specific value and returns its relative position in a given range of cells. The output is the first position found for the given value. Being a lookup and reference function, it works for both an exact and approximate match. For example, if the range A11:A15 consists of the numbers 2, 9, 8, 14, 32, the formula “MATCH(8,A11:A15,0)” returns 3. This is because the number 8 is at the third position.

In simple words, the MATCH formula is given as follows:

“MATCH(value to be searched, array, exact or approximate match [1, 0 or -1])”

Table of contents
  • MATCH Function in Excel
    • The Syntax of the MATCH Excel Function
    • How to use the MATCH Function in Excel? (With Examples)
      • Example #1–Exact Match
      • Example #2–Approximate Match
      • Example #3–Wildcard Character (Partial Match)
      • Example 4–INDEX MATCH
    • The Properties of the MATCH Excel Function
    • Frequently Asked Questions
    • Recommended Articles

The Syntax of the MATCH Excel Function

The syntax of the function is shown in the following image:

Match Formula

The function accepts the following arguments:

  • Lookup_value: This is the value to be searched in the “lookup_array.”
  • Lookup_array: This is the array or range of cells where the “lookup_value” is to be searched.
  • Match_type: This takes the values 1, 0, or -1 depending on the type of match.

For instance, you may want to search a specific word (lookup_value) in the dictionary (lookup_array).

The arguments “lookup_value” and “lookup_array” are mandatory, while “match_type” is optional.

The Values of “Match_Type”

The “match_type” can take any of the following values:

Positive one (1): The function looks for the largest value in the “lookup_array,” which is less than or equal to the “lookup_value.” The data is arranged in alphabetical (A to Z) or ascending order and an approximate match is returned.

Zero (0): The function looks for an exact match of the “lookup_value” in the “lookup_array.” The data is not required to be arranged.

Negative one (-1): The function looks for the smallest value in the “lookup_array,” which is greater than or equal to the “lookup_value.” The data is arranged in reverse order of alphabets (Z to A) or descending order and an approximate match is returned.

Note: The default value of “match_type” is 1.

How to use the MATCH Function in Excel? (With Examples)

Let us understand the working of the MATCH formula with the help of examples.

You can download this MATCH Function Excel Template here – MATCH Function Excel Template

Example #1–Exact Match

The succeeding table shows the serial number (S.N.), name, and department of ten employees in an organization. We want to find the position of the employee “Tanuj.”

We apply the following formula.

“=MATCH(F4,$B$4:$B$13,0)”

The “match_type” is set at 0 to return the exact position of “Tanuj” (lookup_value) from the range $B$4:$B$13 (lookup_array). The output is 1.

MATCH Function Example 1

Example #2–Approximate Match

The succeeding list shows the values from 100 to 1000. We want to find the approximate position of the value 525.

We apply the following formula.

“=MATCH(E19,B19:B28,1)”

The “match_type” is set at 1 to return the approximate match of 525 (lookup_value) from the range B19:B28 (lookup_array).

The MATCH function looks for the largest value (500), which is less than 525 in the given array. Hence, the output is 5.

MATCH Function Example 2

Example #3–Wildcard Character (Partial Match)

The MATCH function supports the usage of wildcard charactersIn Excel, wildcards are the three special characters asterisk, question mark, and tilde. Asterisk denotes multiple characters, a question mark denotes a single character, and a tilde denotes the identification of a wild card character.read more (? and *) in the “lookup_value” argument. Let us consider an example of the same.

The succeeding list shows ten IDs of the various employees of an organization. We want to find the position of the ID ending with 105.

We apply the following formula.

“=MATCH(“*”&E33,$B$33:$B$42,0)”

The wildcard characters are used for partial matches and the “match_type” is set at zero. The output is 5. This implies that the ID at the fifth position is ending with 105.

MATCH Function Example 3

Example 4–INDEX MATCH

The MATCH and INDEX functionThe INDEX function can return the result from the row number, and the MATCH function can give us the position of the lookup value in the array. This combination of the INDEX MATCH is beneficial in addressing a fundamental limitation of VLOOKUP.read more are used together to look up a value in the table from right to left.

The succeeding table shows the serial number (S.N.), name, and department of ten employees in an organization. We want to find the serial number of the employee “Tanuj.”

We apply the following formula.

“=INDEX(B46:D56,MATCH(G48,C46:C56,0),1)”

The MATCH function searches for the exact word “Tanuj” in the range C46:C56 and returns 2. The output 2 is supplied as the row number to the INDEX functionThe INDEX function in Excel helps extract the value of a cell, which is within a specified array (range) and, at the intersection of the stated row and column numbers.read more. The INDEX function returns the value from the second row and first column of the range B46:D56.

The output of the formula is 1. This implies that the serial number of “Tanuj” is 1.

Example 4

The following image shows the output when the “lookup_value” is “Tanujh.” Since “Tanujh” could not be found in column B, the outcome is “#N/A” error.

Example 5

The Properties of the MATCH Excel Function

  • It is not case-sensitive which implies that it does not distinguish between the uppercase and lowercase letters.
  • It returns the relative position of the “lookup_value” in the “lookup_array.”
  • It works with one-dimensional ranges or arrays which can be either vertical or horizontal.
  • If there are multiple occurrences of the “lookup_value” in the “lookup_array,” it returns the position of the first exact match.
  • If the “lookup_value” is in text form, the wildcard characters like a question mark (?) and asterisk (*) can be used for partial matches.
  • It returns the “#N/A” error if it is unable to find the “lookup_value” in the “lookup_array.”

Frequently Asked Questions

1. Define the MATCH function of Excel.

The MATCH function returns the position of a given value from a vertical or horizontal array or range of cells. It returns both approximate and exact matches from unsorted and sorted data lists respectively.

The MATCH function can be used in combination with the INDEX function to extract a value from the position supplied by the former. The MATCH function accepts the arguments “lookup_value,” “lookup_array,” and “match_type.”

The first two arguments are mandatory, while the last is optional. The “match_type” can take the values 1, 0 or -1 depending on the type of match. The value 0 refers to an exact match, while 1 and -1 refer to an approximate match.

2. How is the MATCH function used to compare two columns in Excel?

The MATCH function is used in combination with the IF and ISNA functions to compare two columns. The formula is stated as follows:

“IF(ISNA(MATCH(first value in list1,list2,0)),“not in list 1”,“”)”

The formula looks for a value of “list 1” in “list 2.” If it is able to find a value, its relative position is returned. However, if a value of “list 2” is not present in “list 1,” the formula returns the text “not in list 1.”

3. What is the INDEX MATCH formula of Excel?

The INDEX MATCH formula uses a combination of the INDEX and MATCH functions. The INDEX function looks for a value in an array based on the specified row and column numbers. These row and column numbers are supplied by the MATCH function.

The INDEX MATCH formula for a vertical lookup is stated as follows:

“INDEX(column to return a value from,MATCH(lookup_value,column to look up against,0)”

The “column to return a value from” is the “array” argument of the INDEX function. The “column to look up against” is the “lookup_array” argument of the MATCH function.

Note: The “array” argument of the INDEX function must contain the same number of rows as the “lookup_array” argument of the MATCH function.

Recommended Articles

This has been a guide to the MATCH function in excel. Here we discuss how to use Match Formula along with step by step excel example. You can download the Excel template from the website. Take a look at these lookup and reference functions of Excel-

  • Excel Match Multiple CriteriaCriteria based calculations in excel are performed by logical functions. To match single criteria, we can use IF logical condition, having to perform multiple tests, we can use nested IF conditions. But for matching multiple criteria to arrive at a single result is a complex criterion-based calculation.read more
  • Excel Mathematical FunctionMathematical functions in excel refer to the different expressions used to apply various forms of calculation. The seven frequently used mathematical functions in MS excel are SUM, AVERAGE, AVERAGEIF, COUNTA, COUNTIF, MOD, and ROUND.read more
  • INDEX FormulaThe INDEX function in Excel helps extract the value of a cell, which is within a specified array (range) and, at the intersection of the stated row and column numbers.read more
  • VBA MatchIn VBA, the match function is used as a lookup function and is accessed by the application. worksheet method. The arguments for the Match function are similar to the worksheet function.read more

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.

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.

Compare Columns - row by row - dataset

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

The below formula would do this:

=A2=B2

Compare Lists in Excel - matches are shown as TRUE

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

If formula to compare columns in Excel

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.Click the Home Tab in the Excel ribbon
  3. In the Styles group, click on the ‘Conditional Formatting’ option.Click on Conditional Formatting
  4. From the drop-down, click on ‘New Rule’.Click on the New Rule option
  5. In the ‘New Formatting Rule’ dialog box, click on the ‘Use a formula to determine which cells to format’.Click on Use Formula option
  6. In the formula field, enter the formula: =$A1=$B1Formula to compare columns in Conditional Formatting
  7. Click the Format button and specify the format you want to apply to the matching cells.Set Formatting in conditional formatting
  8. Click OK.

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

Compare two columns and highlight matching rows

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:

Compare two columns and highlight macthes - dataset

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.Click on Conditional Formatting
  4. Hover the cursor on the Highlight Cell Rules option.
  5. Click on Duplicate Values.Select Duplicate Values in Conditional Formatting
  6. In the Duplicate Values dialog box, make sure ‘Duplicate’ is selected.Duplicate in Conditional Formatting
  7. Specify the formatting.Specify the formatting in conditional formatting
  8. Click OK.

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

Highlighted matching data when comparing lists in Excel

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.Click on Conditional Formatting
  4. Hover the cursor on the Highlight Cell Rules option.
  5. Click on Duplicate Values.Select Duplicate Values in Conditional Formatting
  6. In the Duplicate Values dialog box, make sure ‘Unique’ is selected.Select Unique to highlight differences
  7. Specify the formatting.Specify the formatting to highlight differences in two columns
  8. Click OK.

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

Compare Two columns and highlight differences

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,

Compare two columns and highlight macthes - dataset

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.

compare lists and find missing data

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.

Compare two lists in Excel and fetch matching data

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)

Lookup and Pull matching data - market valuation Excel

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

Pull matching Data - partial match

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)

Partial comparison in columns with wildcard characters

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)

Понравилась статья? Поделить с друзьями:
  • Match and make up sentences with these word
  • Match 1 5 with a f there is one word that you do not need
  • Match and if function in excel
  • Mat file to excel
  • Match adjectives and nouns to make word combinations