## If cell equals value from list

#### Regular formula

Formula in cell C3:

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($E$3:$E$5,B3)

becomes

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

and returns 0 (zero).

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

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

becomes

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

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

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.

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

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

The OR function returns FALSE since all arguments are FALSE.

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 perform numerous conditions

The COUNTIF function allows you to construct a small IF formula that carries out plenty of logical expressions. Combining the IF […]

Use IF + COUNTIF to perform numerous conditions

### Download excel *.xlsx file

Checks if a logical expression is met. Returns a specific value if TRUE and another specific value if FALSE.

If cell contains text from list

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

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

If cell contains multiple values

The array formula in cell C3 checks if text string in B3 contains all values in F2:F3. Weekly Blog EMAIL […]

Here is how to highlight every other row using conditional formatting. Conditional formatting formula: =ISEVEN(ROW())*OR($B3:$D3<>"") Alternative CF formula: =EVEN(ROW())=ROW() This […]

Question: I have a list that I keep adding rows to. How do i create a border that expands as […]

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