## If cell equals value from list

This article demonstrates formulas that check if a cell value is equal to any value in a given list.

#### Table of Contents

## 1. If cell equals value from list - regular formula

Formula in cell C3:

### Explaining formula in cell C3

#### Step 1 - Count cells based on condition

The COUNTIF function counts how many values in E3:E5 match cell B3, it returns 0 (zero) since "A" is not found in E3:A5.

COUNTIF(*range*, *criteria*)

COUNTIF($E$3:$E$5,B3)

becomes

COUNTIF({"B";"D";"H"},"A")

and returns 0 (zero).

#### Step 2 - Count cells based on condition

The IF function then returns "YES" if the logical expression is 1 or more, "No" if the logical expression returns 0 (zero).

IF(*logical_test*, [*value_if_true*], [*value_if_false*])

IF(COUNTIF($E$3:$E$5,B3),"Yes","No")

becomes

IF(0,"Yes","No") and returns "No" in cell C3.

## 2. If cell equals value from list - array formula

I recommend using the regular formula above, this array formula checks if cell B3 is equal to any of the values in E3:E5, the IF function returns Yes if one of the values is a match and No if none of the values match.

### 2.1 How to enter an array formula

To enter an array formula, type the formula in a cell and then press and hold CTRL + SHIFT simultaneously, now press Enter once. Release all keys.

The formula bar now shows the formula enclosed with curly brackets telling you that you entered the formula successfully. Don't enter the curly brackets yourself.

### 2.2 Explaining formula in cell C3

#### Step 1 - Compare values

The equal sign compares the value in cell B3 with each value in cell range E3:E5.

B3=$E$3:$E$5

becomes

"A"={"B";"D";"H"}

and returns

{FALSE; FALSE; FALSE}. If the cell matches a value in E3:E5 it returns TRUE, if not FALSE. In this case, all logical expressions return FALSE.

#### Step 2 - Evaluate OR function

The OR function returns TRUE if at least one argument is TRUE.

OR(*logical1*, *[logical2]*)

OR(B3=$E$3:$E$5)

becomes

OR({FALSE; FALSE; FALSE})

and returns FALSE. The OR function returns FALSE since all arguments are FALSE.

#### Step 3 - Evaluate IF function

The IF function returns "YES" if the logical expression is TRUE, "No" if the logical expression is FALSE.

IF(*logical_test*, [*value_if_true*], [*value_if_false*])

IF(OR(B3=$E$3:$E$5),"Yes","No")

IF(FALSE,"Yes","No")

and returns "No". The IF function then returns No in cell C3.

### Alternative regular formula

The INDEX function changes the above formula into a regular formula.

The INDEX and SUMPRODUCT functions have this characteristic, you just have to know when and where to apply them.

### Related post

Use IF + COUNTIF to evaluate multiple conditions

The image above demonstrates a formula that matches a value to multiple conditions, if the condition is met the formula […]

Use IF + COUNTIF to evaluate multiple conditions

## 4. If cell equals value from list case sensitive

Formula in cell C3:

=IF(OR(EXACT(B3, $E$3:$E$5)), "Yes", "No")

### 4.1 Explaining formula in cell C3

#### Step 1 - Identify equal values case sensitive

The EXACT function lets you compare values also considering upper and lower cases.

EXACT(*text1*, *text2*)

EXACT(B3, $E$3:$E$5)

becomes

EXACT("A", {"b"; "D"; "H"})

and returns

{FALSE; FALSE; FALSE}.

#### Step 2 - Evaluate OR function

The OR function returns TRUE if at least one argument is TRUE.

OR(*logical1*, *[logical2]*)

OR(EXACT(B3, $E$3:$E$5))

becomes

OR({FALSE; FALSE; FALSE})

and returns FALSE.

#### Step 3 - Evaluate IF function

The IF function returns "YES" if the logical expression is TRUE, "No" if the logical expression is FALSE.

IF(*logical_test*, [*value_if_true*], [*value_if_false*])

IF(OR(EXACT(B3, $E$3:$E$5)), "Yes", "No")

becomes

IF(FALSE, "Yes", "No")

and returns "No".

## 5. Get excel *.xlsx file

This article demonstrates several ways to check if a cell contains any value based on a list. The first example […]

This article demonstrates formulas that perform a partial match for a given cell using multiple strings specified in cells F2 […]

The image above demonstrates a formula that matches a value to multiple conditions, if the condition is met the formula […]

The AND function allows you to have multiple conditions in an IF function, you can have up to 254 arguments. […]

Nested IF statements in a formula are multiple combined IF functions so more conditions and outcomes become possible. They all are […]

This article demonstrates different formulas based on if a cell contains a given text. Formula in cell C3: =B3=$E$3 The […]

The picture above shows different values in column B and a formula in column C that tries to identifies the […]

The easiest way to check if a cell has a value is, in my opinion, to use the equal sign […]

### One Response to “If cell equals value from list”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

How do you combine two of these statements? Eg Col B is Item, Col C is Area, and Col E is selected Items and Col F is selected Areas. If you wanted to see if the first entry on E and F existed in the same row in B and C, then it would mark 'Yes' and 'No for those that don't.