## 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

This example demonstrates a formula that returns "Yes" if the adjacent cell on the same row is equal to at least one of the values in cell range E3:E5. "No" is returned if none of the values is equal to the adjacent value in column B.

Formula in cell C3:

For example, cell B3 contains value "A". The formula in cell C3 returns "No" because none of the values in cell range E3:E5 is equal to "A".

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

Excel 365 users can enter this formula as a regular formula.

### 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

Recommended articles

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

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

This example demonstrates a formula that performs a case sensitive comparison between a given value and multiple values in a cell range.

Array formula in cell C3:

For example, cell B4 contains "B" and the formula in cell C4 returns "No" because none of the values in cell range E3:E5 is equal to the value also considering upper and lower letters.

Excel 365 users can enter this formula as a regular formula.

### 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

If cell equals value from list.xlsx

### Logic category

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 […]

### Excel categories

### 2 Responses 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.

Brilliant, the first formula was exactly what I needed! Thanks so much