Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • What-If Analysis: Scenarios and Goal Seek in Excel
  • Conditional Formatting Color Scales Examples in Excel
  • Data Series in Excel
  • How to Create One and Two Variable Data Tables in Excel
  • Conflicting Multiple Conditional Formatting Rules in Excel

References

  • Approximate match with multiple criteria in Excel
  • Basic INDEX MATCH approximate in Excel
  • Offset in Excel
  • How to use Excel ROW Function
  • CHOOSE function: Description, Usage, Syntax, Examples and Explanation

Data Validations

  • Excel Data validation only dates between
  • Excel Data validation whole percentage only
  • Excel Data validation must contain specific text
  • Data validation must not exist in list
  • Excel Data validation allow weekday only

How to check cell equals one of many things in Excel

by

If you want to test a cell to see if it equals one of several things, you can do so with a formula that uses the SUMPRODUCT function.

Case study:  Let’s say you have a list of text strings in the range B5:B11, and you want to test each cell against another list of things in range E5:E9. In other words, for each cell in B5:B11, you want to know: does this cell equal any of the things in E5:E9?

You could start build a big formula based on nested IF statements, but an array formula based on SUMPRODUCT is a simpler, cleaner approach.

Formula

=SUMPRODUCT(--(A1=things))>0

Explanation

The solution is to to create a formula that will test for multiple values and return a list of TRUE / FALSE values. Once we have that, we can process that list (an array, actually) with SUMPRODUCT.

The formula we’re using looks like this:

=SUMPRODUCT(--(B5=things))>0

How this formula works

The key is this snippet:

--(B5=things)

which simply compares the value in B5 to every value in the named range “things”. Because we are comparing B5 to an array (i.e. the named range “things”, E5:E11) the result will be an array of TRUE / FALSE values like this:

{TRUE;FALSE;FALSE;FALSE;FALSE}

If we have even one TRUE in the array, we know that B5 equals at least one thing in the list, so, to force the TRUE / FALSE values to 1s and 0s, we use a double negative (–, also called a double unary). After this coercion, we have this:

{1;0;0;0;0}

Now we process the result with SUMPRODUCT, which will add up the elements in the array. If we get any non-zero result, we have at least one match, so we use >1 to force a final result of either TRUE or FALSE.

With a hard-coded list

There’s no requirement that you use a range for your list of things. If you’re only looking for a small number of things, you can use a list in array format, which is called an array constant. For example, if you’re just looking for the colors red, blue, and green, you can use {“red”,”blue”,”green”} like this:

--(B5={"red","blue","green"})

Dealing with extra spaces

If the cells you are testing contain any extra space, they won’t match properly. To strip all extra space, you can modify the formula to use the TRIM function like so:

=SUMPRODUCT(--(TRIM(A1)=things))>0

Post navigation

Previous Post:

DECIMAL function: Description, Usage, Syntax, Examples and Explanation

Next Post:

AVERAGE function: Description, Usage, Syntax, Examples and Explanation

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • IFS function: Description, Usage, Syntax, Examples and Explanation
  • Not Equal To ‘<>‘ operator in Excel
  • Complete List of Excel Logical Functions, References and Examples
  • XOR function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel FALSE Function

Date Time

  • Two ways to sum time over 30 minutes in Excel
  • Get days, months, and years between dates in Excel
  • Display Days until expiration date in Excel
  • WORKDAY.INTL function: Description, Usage, Syntax, Examples and Explanation
  • MINUTE function: Description, Usage, Syntax, Examples and Explanation

Grouping

  • Group times into 3 hour buckets in Excel
  • How to randomly assign data to groups in Excel
  • Map inputs to arbitrary values in Excel
  • Group times into unequal buckets in Excel
  • Running count group by n size in Excel

General

  • Excel Ribbon Quick Overview For Beginners
  • AutoFit Column Width, AutoFit Row Height in Excel
  • Check if multiple cells have same value with case sensitive in Excel
  • Customize Ribbon In Excel
  • Zoom Worksheet in Excel
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning