Go Back

If this AND that

While working with Excel, we are able to evaluate two or more conditions and customize the actions by using the IF and AND functions.  This step by step tutorial will assist all levels of Excel users in marking items in a database that satisfy two conditions.  

Figure 1. Final result: IF this AND that

Final formula: =IF(AND(C3="Non-Reusable",D3="Plastic"),"x","")

Syntax of IF Function

IF function evaluates a given logical test and returns a TRUE or a FALSE

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

  • The arguments “value_if_true” and “value_if_false” are optional.  If left blank, the function will return TRUE if the logical test is met, and FALSE if otherwise.  

Syntax of AND Function

AND function evaluates all logical tests and returns a TRUE if all arguments are TRUE; FALSE if one or more arguments is FALSE

=AND(logical1, [logical2], ...)


  • logical1–  the first condition that we want to test
  • only logical1 is required; succeeding conditions are optional  

Setting up Our Data

Our table contains a list of Item ID (column B), Category (column C), Material (column D) and Indicator (column E). In cells E3:E9, we want to indicate whether an item is a “Non-Reusable Plastic” or not.  

Figure 2. Sample data for IF this AND that

IF “Non-Reusable” AND “Plastic”

In order to mark an item if it is both “Non-Reusable” and made of “Plastic”, we follow these steps:

Step 1.  Select cell E3

Step 2.  Enter the formula: =IF(AND(C3="Non-Reusable",D3="Plastic"),"x","")

Step 3: Press ENTER

Step 4: Copy the formula in cell E3 to cells E4:E9 by clicking the “+” icon at the bottom right-corner of cell E3 and dragging it down.  

Figure 3. Entering the formula to mark IF “Non-Reusable” AND “Plastic”

The first part of our formula tests two conditions using the AND function: if the category of an item is “Non-Reusable”, and if the material is “Plastic”.  When both conditions are satisfied, the IF function returns the character “x”, which marks the item as a “Non-Reusable Plastic”.  Otherwise, it returns an empty string “”.  

As a result, our formula returns an “x” in cells E3, E6 and E8, which satisfy our two conditions.  

Figure 4. Output: Mark “x” IF “Non-Reusable” AND “Plastic”

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

hi there, how do you write a formula so that if a celll says W then you add this and this, if it says L then you add this and this? does that make sense?
Solved by G. F. in 20 mins
We have already seen that this can be written as =IF(A1<=-5, 0, IF(A1>5, 0, A1)) and =IF(A1>-5, IF(A1<=5, A1, 0), 0). However, there are other ways that this can be written using other logical operators (IF, AND, NOT, OR), try to think of other ways to write this function and submit ONE of them in the text box.
Solved by T. S. in 29 mins
I need a formula that says if this date falls inbetween 2 dates, then give me this (cell reference) and if not give me 0
Solved by S. J. in 14 mins

Leave a Comment