How to check if a cell equals one of several values in Excel
Formula (Excel and Google Sheets)
=IF(OR(B2="CA",B2="OR",B2="WA"),"West","Central")List the matches inside OR: =IF(OR(B2="CA",B2="OR",B2="WA"),"West","Central"). For a long list, keep it in cells and use COUNTIF.
- Result on the example
- one result per row in
C2, filled down toC8 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in C2, filled down to C8. Change any input and the result updates, or edit the formula to experiment.
How it works
Each B2="…" is its own TRUE/FALSE test, and OR returns TRUE if any of them is TRUE. IF then picks the warehouse. The comparisons ignore case, so "wa" matches too.
=IF(OR(B2="CA",B2="OR",B2="WA"),"West","Central")Result"West"
B2"CA"The value in B2.
B2="CA"TRUEThe = operator tests whether the two sides are equal.
B2="OR"FALSEThe = operator tests whether the two sides are equal.
B2="WA"FALSEThe = operator tests whether the two sides are equal.
OR(B2="CA",B2="OR",B2="WA")TRUEOR: TRUE if any argument is true.- logical1
B2="CA"TRUE - logical2
B2="OR"FALSE - logical2
B2="WA"FALSE
- logical1
IF(OR(B2="CA",B2="OR",B2="WA"),"West","Central")"West"IF: Returns one value if a test is true, another if false.- logical_test
OR(B2="CA",B2="OR",B2="WA")TRUE - value_if_true
"West" - value_if_false
"Central"not used
- logical_test
In Google Sheets
The same formula works in Google Sheets: =IF(OR(B2="CA",B2="OR",B2="WA"),"West","Central"). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =IF(COUNTIF($E$2:$E$4,B2),"West","Central") | West, Central, West… | Keeps the list on the sheet: COUNTIF returns 1 when the state is in E2:E4. Best when the list is long or changes. |
| =IF(OR(B2={"CA","OR","WA"}),"West","Central") | West, Central, West… | An array constant compares against all three at once. In Google Sheets, wrap it in ARRAYFORMULA. |
Common mistakes
=IF(B2="CA" OR "WA",…)is not valid, andB2=OR("CA","WA")returns #VALUE!. Each value needs its own comparison inside OR.- Lock the list range with $ when you use the COUNTIF version, or it slides down as you fill.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Check if a cell equals one of several values
C2, show "West" when the state is CA, OR or WA, and "Central" for any other state. Fill down to C8.Questions
How do I check that a cell is none of the values?
Wrap the test in NOT: =IF(NOT(OR(B2="CA",B2="OR",B2="WA")),"Central","West"), or test COUNTIF($E$2:$E$4,B2)=0.
How do I return a different result for each value?
Use SWITCH or a lookup table: =SWITCH(B2,"CA","Reno","WA","Tacoma","Dallas").
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.