How to use IF function with 3 conditions

November 18, 2021

I received a lot of questions on how to use IF function with 3 conditions, so I've decided to write an article on this topic.

The IF examples described in this article assume that you have a basic understanding of how the IF function works. All examples from this article work in Excel for Microsoft 365 or Excel 2019, 2016, 2013, 2010, and 2007.

If you are unfamiliar with the IF function, then I strongly recommend reading my article on Excel IF function first. It's a step-by-step guide, and it includes a lot of useful examples. It also shows the basics of writing an Excel IF statement with multiple conditions, but it's not as detailed as this guide. Make sure you also download the exercise file.

As a data analyst, you need to be able to evaluate multiple conditions at the same time and perform an action or display certain values when the logical tests are TRUE. This means that you will need to learn how to write more complex formulas, which sooner or later will include multiple IF statements in Excel, nested one inside the other.

Let's take a look at how to write a simple IF function with 3 logical tests.

How to use IF function with 3 conditions

The first example uses an IF statement with three OR conditions. We will use an IF formula which sets the Finance division name if the department is Accounting, Financial Reporting, or Planning & Budgeting.

The IF statement from cell E31 is:
=IF(OR(D31="Accounting", D31="Financial Reporting", D31="Planning & Budgeting"), "Finance", "Other")

IF function with 3 conditions

This IF formula works by checking three OR conditions:

  • Is the data from the cell D31 equal to Accounting? In our case, the answer is no, and the formula continues and evaluates the second condition.
  • Is the text from the cell D31 equal to Financial Reporting? The answer is still no, and the formula continues and evaluates the third condition.
  • Is the text from the cell D31 equal to Planning & Reporting? The answer is yes, our IF function returns TRUE, and displays the word Finance in cell E31.

Next, we focus our attention on an example that uses an IF statement with three AND conditions.

Our table shows exam scores for three exams. If the student received a score of at least 70 for all three exams, then we will return Pass. Otherwise, we will display Fail.

The IF statement from cell H53 is:
=IF(AND(E53>=70, F53>=70, G53>=70), "Pass", "Fail")

IF function with 3 logical tests

This IF formula works by checking all three AND conditions:

  • Is the score for Exam 1 higher than or equal to 70? In our case, the answer is yes, and the formula continues and evaluates the second condition.
  • Is the score for Exam 2 higher than or equal to 70? Well, yes it is. Now the formula moves to the third condition.
  • Is the score for Exam 3 higher than or equal to 70? Yes, it is. Since all three conditions are met, the IF statement is TRUE and returns the word Pass in cell H53.

Excel IF statement with multiple conditions

The final section of this article is focused on how to write an Excel IF statement with multiple conditions, and it includes two examples:

  • multiple nested IF statements
  • formula with a mix of AND, OR, and NOT conditions

Multiple nested IF statements

In this example, I have calculated the grade of the students based on their scores using a formula with 4 nested IF functions.

=IF(E107<60, "F", IF(E107<70, "D", IF(E107<80, "C", IF(E107<90, "B" ,"A"))))

Note: In this case, the order of the conditions influences the result of your formula. When your conditions overlap, Excel will return the [value_if_true] argument from the first IF statement that is TRUE and ignores the rest of the values. If you want your formula to work properly, always pay attention to the logical flow and the order of your nested IF functions.

If you have to write an IF statement with 3 outcomes, then you only need to use one nested IF function. The first IF statement will handle the first outcome, while the second one will return the second and the third possible outcomes.

4 nested IF statements

Note: If you have Office 365 installed, then you can also use the new IFS function. You can read more about IFS on Microsoft’s website.

Multiple IF statements in Excel with AND, OR, and NOT conditions

I have saved the best for last. This example is the most advanced from this article, as it involves an IF statement with several other logical functions.

In the exercise file, I have included a list of orders. Each row includes the order date, the order value, the product category, and the free shipping flag. We want to flag orders as eligible if the following cumulative logical conditions are met:

  • the order was placed during 2020
  • the order includes products from only two categories: PC or Laptop
  • the order was not flagged as Free shipping

The formula I've used for cell H80 is shown below:

=IF(AND(D80>=DATE(2020,1,1), D80<=DATE(2020,12,31), OR(F80="PC", F80="Laptop"), NOT(G80="Yes")), "Eligible", "Not eligible")

IF statement with AND, OR, and NOT functions

Here's how this works:

  1. AND makes sure that all the logical conditions need to be met to flag the order as Eligible. If any of them is FALSE, then our entire IF statement will return the [value_if_false] argument.
  2. D80>=DATE(2020,1,1) and D80<=DATE(2020,12,31) check if the order was placed between January 1st and December 31st, 2020.
  3. OR is used to check whether the product category is PC or Laptop.
  4. Finally, NOT is used to check if the Free shipping flag is different from Yes.

And there you have it. I hope that after reading this guide, you have a much better understanding of using IF function with 3 logical tests (or any number actually). While it may seem intimidating at first, I guarantee that if you write an IF formula with multiple criteria daily, your productivity will eventually skyrocket.

This is why, if you have any questions on how to use IF function with 3 conditions, please leave a comment below and I will do my best to help you out. I reply to every comment or email that I receive.

Thousands of people have benefited from my free Excel lessons. My only question is, will you be next?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

152 comments on “How to use IF function with 3 conditions”

  1. Hi Radu,

    I'm trying to write a formula with three outcomes based on the value in a cell:
    =IF(AND(H131 > 25, H131=75), "Right", IF(H131 < =25), "Left"))

    I keep getting an error message and can't figure out my mistake. Thanks!

    1. Hi Brian,

      You have an extra parenthesis in the second IF statement. Also, try to use the same double quotation marks, as this can also trigger errors. Try this formula:

      =IF(AND(H131 > 25, H131 = 75), "Right", IF(H131 <= 25, "Left"))

  2. I'm trying to do a formula where if F2 is greater than E2 it equals a 1 and if not it equals a 0. My options in E2 and F2 are BASE, SILVER, GOLD, PLATINUM, DIAMOND.

    So basically if E2=SILVER AND F2=GOLD IT WOULD BE A 1.

    This is the formula I came up with:

    =IF(AND(E2="SILVER", F2="GOLD", 1, IF(AND(E2="BASE", F2="SILVER", 1, IF(AND(E2="GOLD", F2="PLATINUM", 1, IF(AND(E2="PLATINUM", F2="DIAMOND", 1, 0))))))))

    1. Hi Jenny,

      This requires a more complicated formula and I would suggest using a different approach. This way you can easily change or add more values in the future. I would create a separate table and next to each name I would put a number. For instance, since BASE is the lowest I would assign 1 and increment by one until DIAMOND which has 5.

      Let's assume I have those on columns A and B from rows 1 to 5 like this:
      A1: BASE / B1: 1
      A2: SILVER / B2: 2
      A3: GOLD / B3: 3
      A4: PLATINUM / B4: 4
      A5: DIAMOND / B5: 5

      Then, I would just compare the numbers using a simple IF statement combined with VLOOKUP, like this:

      =IF(VLOOKUP(F2, A1:B5, 2, FALSE) > VLOOKUP(E2, A1:B5, 2, FALSE), 1, 0)

      Let me know if you are able to make it work. If not, we can try a formula using multiple nested IF statements, but it's messy and hard to edit later on.

  3. sorry, the past comment doesn't show well, i will rewrite
    I am working on work progress timeline.
    I have in column A the task completion percentage (from 0% to 100%)
    And in column B a date (task end date)
    I need a formula in column C to:
    if A=100% and B>TODAY() then "COMPLETE"
    if A<100% and B<TODAY() then "ONGOING"
    if A=100% and B<TODAY() then "COMPLETE"
    if ATODAY() then "OVERDUE"

    1. Hi Joe,

      I think that the formula that matches your requirements is this:

      =IF(AND(A1 < 100%, B1 < TODAY()), "OVERDUE", IF(AND(A1 < 100%, B1 >= TODAY()), "ONGOING", "COMPLETE"))

      Let me know if it needs any adjustments.

      All the best,
      Radu

  4. Hi,

    I am working on work progress timeline.
    I have in column A the task completion percentage (from 0% to 100%)
    And in column B a date (task end date)

    I need a formula in column C to:
    1- if ATODAY() then "OVERDUE"
    2- if A=100% and B>TODAY() then "COMPLETE"
    3- if A<100% and B<TODAY() then "ONGOING"
    4- if A=100% and B<TODAY() then "COMPLETE"

    Thanks,

  5. =IF(B147000, "IF(SUM(7000*Q3)"))
    Hello, thank you for the information you've provided---my formula in google sheets isn't working,
    what I'm trying to ask is IF cell b14 is less than then i want the outcome of b14*q3 IF cell b14 is greater than 7000 then i only want the sum of 7000*q3

    b14= 9744
    q3= .006

    thank you so much for your help.
    BLESSINGS

  6. I have 4 columns; I need to find the following
    Column A
    A2 If response is either Yellow, Gold or Orange
    Column B
    B2 If text contains “Shirt”
    Column C
    C2 If text does NOT contain “Apple”
    Column D
    D2 Text is equal to YES

    I would like to know if they are a MATCH, NOT a Match

    Please let me know if you need any more information, thanks

    1. Hi,

      If I got your request right, I thinkg the formula you are looking for is:

      =IF(AND(OR(A2= "Yellow", A2= "Gold", A2= "Orange"), ISNUMBER(SEARCH("Shirt", B2))=TRUE, ISNUMBER(SEARCH("Apple", C2))=FALSE, D2="Yes"), "Match", "Not a match")

      Let me know if this is this works as intended.

      Radu

  7. I have a column with 5 choices, HA, GR, KA, BU, or CA...I need an if statement that assigns a different outcome to each of those choices...this is the code I wrote but it doesn't work...I tried to work it off your example above with the letter grades for the numerical grades, with the BAT being the statement for BU since it is not designated in the statements, so maybe that's the issue....
    =IF(K2=”GR”, "DOG", IF(K2=”CA”, "CAT", IF(K2=”HA”, "HAMSTER", IF(K2=”KA”, "KANGAROO", "BAT"))))

    1. Hi Alison,

      Sorry for the late reply. Your formula was spot on, except for the double-quotes. If you pay close attention, you can see that you've mixed two types of double quotation marks:
      ”” is wrong
      "" is good

      Below is the corrected formula:

      =IF(K2="GR", "DOG", IF(K2="CA", "CAT", IF(K2="HA", "HAMSTER", IF(K2="KA", "KANGAROO", "BAT"))))

      Let me know if that works.

      Radu

  8. Hi Radu, I pasted the table but looks like it got posted without the table

    (A) If : High, Med, Low
    (B) And If: High =4, Med=3, Low = 2 then "Late", else "ok"
    (C) will be the output either late or ok

Essential Functions

Excel Topics

Excel courses

I have compiled a list of the best Excel online courses. It covers basic and advanced topics, VBA, and Power BI.
View courses
Excel is a very complex application, and understanding it on your own may prove difficult and time-consuming. I have created ExcelExplained.com to help you better understand each function and provide useful examples for different tasks. If you can’t find the answer to your question in one of the published articles, please leave a comment or send me an email, and I will do my best to help you out.

Affiliate Disclosure: When you purchase a product through a link on our website, I may earn an affiliate commission. There are no additional costs to you.
Copyright © 2017-2022 ExcelExplained.com