Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Match Not Equal to Excel

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can match a value that is not equal to another using the MATCH function combined with the ISNOTMATCH or logical operators in Excel formulas. This technique is essential for filtering data sets without using the built-in filter tools, allowing you to extract specific rows based on exclusion criteria directly into a new list.

What You'll Need

  • A computer running Microsoft Excel (Windows, Mac, or Web version).
  • A dataset with at least two columns of data.
  • Access to the formula bar or a cell to type the formula.

Step-by-Step

  1. Open your Excel spreadsheet and ensure your data is organized in columns. For this guide, assume you have a list of employees in column A and their departments in column B.
  2. Determine the cell where you want the result to appear. Click on an empty cell to begin typing your formula. This cell will display the results of the match, such as the row number of a match or an error if no match is found.
  3. Start typing the MATCH function. Enter =MATCH( into the selected cell. The MATCH function syntax is MATCH(lookup_value, lookup_array, [match_type]).
  4. Enter the lookup value. This is the value you want to find or exclude. For a "not equal to" match, you will typically reference a cell that contains the value you want to exclude, or use a logical operator within the array, but the most common method is to use ISERROR or IF to handle the result.
  5. Enter the lookup array. This is the range of cells you want to search. To find values that are not equal to a specific item, you cannot simply use a range; you must use an array formula that checks each cell in the range against the exclusion criteria.
  6. Use the ISNA or ISERROR function. The MATCH function returns a number if a match is found and the error #N/A if no match is found. To identify rows that do not contain the value, you need to check for the error. Type ISNA(MATCH( or ISERROR(MATCH( immediately after the opening parenthesis of the MATCH function.
  7. Refine the formula for the lookup array. The syntax becomes ISNA(MATCH(lookup_value, (lookup_array<>lookup_value), 0)). The part (lookup_array<>lookup_value) creates an array where TRUE represents a match and FALSE represents a non-match. MATCH looks for the TRUE values in this array.
  8. Close the parenthesis and press Enter. The final formula structure looks like this: =IF(ISNA(MATCH(A2, (B:B<>"Sales"), 0)), "Found", "Not Found"). This formula checks if the value in cell A2 is not equal to "Sales" in column B and returns "Found" if it is and "Not Found" if it is not.
  9. Drag the formula down. To apply this to the entire column, click the bottom-right corner of the cell and drag it down to cover the data range. Ensure you lock the reference to the exclusion value (e.g., $B$2 or "Sales") if you want to keep the exclusion criteria constant while checking each row.

Common Mistakes

One of the most frequent errors is attempting to use the standard IF function with a direct comparison operator on a range, such as =IF(A:A<>"Sales", TRUE, FALSE). This syntax is invalid in Excel because the IF function expects a single logical test, not a range of comparisons. Always use the MATCH function within an ISNA or IFERROR wrapper to evaluate the presence or absence of a match across a range.

Another mistake is not accounting for case sensitivity. The standard MATCH function is not case-sensitive. If you need to match "Sales" exactly as written (e.g., excluding "sales" or "Sales "), you must add the EXACT function to your formula, such as ISNA(MATCH(A2, (EXACT(B:B, "Sales")), 0)). Without this, Excel will treat "sales" and "Sales" as identical, which may not be the intended behavior for your data.

Tips

When working with large datasets, the array formula approach described above can be slow because it evaluates every cell in the range. To improve performance, try using the AGGREGATE function with the 15 option (which ignores errors) or the FILTER function (available in newer versions of Excel). The FILTER function is often the simplest method: =FILTER(A:A, B:B<>"Sales", "No matches"). This will return a list of all values in column A where the corresponding value in column B is not "Sales".

For users who need to perform this check across multiple columns, you can concatenate the columns before applying the comparison. For example, if you want to exclude rows where the first name is "John" and the last name is "Doe", you can use a helper column with the formula =A2&" "&B2 and then compare that result to "John Doe". This simplifies the logical test to a single comparison.

Troubleshooting

If the formula returns #VALUE!, it usually means you have referenced an entire column (e.g., A:A) in the ISNA or ISERROR function, and the array calculation is not supported in that specific context. Try restricting the range to a specific column of data, such as A1:A1000, to resolve the error.

If the formula returns all FALSEs or all TRUEs, check the syntax of the comparison operator. Ensure you are using the standard less-than sign (<), not the HTML entity (&lt;). Also, verify that the exclusion value in your formula exactly matches the data in the cells, including any leading or trailing spaces. Using the TRIM function on your data range, such as (TRIM(B:B)<>"Sales"), can often fix mismatches caused by accidental spaces.

Frequently Asked Questions

How do I match a value not equal to a list of items?

To match a value not equal to a list of items, you can use the COUNTIF function. The formula =IF(COUNTIF(list_range, text_to_check)=0, "Not in list", "In list") will return TRUE if the text is not found in the specified range.

Can I use wildcards in the MATCH function for "not equal to"?

Yes, you can use wildcards like * and ? within the lookup_value argument. For example, =ISNA(MATCH("*text", A:A, 0)) will match any cell containing "text" anywhere within the string, regardless of surrounding characters.

Why does my formula return a row number instead of TRUE or FALSE?

The MATCH function is designed to return the relative position of an item in a range. If you want a simple TRUE/FALSE result, you must wrap the MATCH function in an ISNA or ISERROR function, or use an IF function to convert the result into a boolean.

What is the difference between MATCH and VLOOKUP for this purpose?

MATCH is used to find the position of a value in a range, while VLOOKUP is used to retrieve a value from another column based on a match. For a simple exclusion check, MATCH is sufficient, but VLOOKUP is necessary if you need to retrieve the actual data associated with the non-matching row.

Does the MATCH function work with dates?

Yes, the MATCH function works with dates as long as they are formatted as dates in Excel. You can exclude dates by comparing them to a specific date value, such as =ISNA(MATCH(A2, (B:B<DATE(2023,1,1)), 0)).