How to use IF function with 3 conditions

I received a lot of questions on how to use the 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 2021, 2019, 2016, 2013, 2010, and 2007.

IF is one of the most used Excel functions. In case you are unfamiliar with the IF function, then I strongly recommend reading my article on the 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 the 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 (also known as nested IFS)
  • formula with a mix of AND, OR, and NOT conditions

How many IF statements can you nest in Excel? The answer is 64, but I’ve never seen a formula that uses that many. Also, I’m sure that there are far better alternatives to using such a complicated formula.

Multiple nested IF statements

In this example, I have calculated the grades 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.

I’ve also added a video that shows how to nest IF functions in case you are still having difficulties understanding how a nested IF formula works.

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

About me

My name is Radu Meghes, and I'm the owner of excelexplained.com. Over the past 15+ years, I have been using Microsoft Excel in my day-to-day job. I’ve worked as an investment and business analyst, and Excel has always been my most powerful weapon. Its flexibility and complexity make it a highly demanded skill for finance employees. I launched excelexplained.com back in 2017, and it has become a trusted source for Excel tutorials for hundreds of thousands of people each year.

If you'd like to get in touch, you can contact me on LinkedIn.

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

  • Hi I Have two columns of data.
    I would like to simplify these into a result that provides a sell or buy statement.

    The conditions are to buy if cell A1 is equal or greater than 0.2 but less than 0.4 and cell B1 equal or greater than 2.0 but less than 4.0

    The conditions to sell are cell A1 is equal or less than -0.2 but less than -0.4 and cell B1 equal or less than -2.0 but greater than 4.0

    Kind regards,

    • Hi Jon,

      Give this a try and let me know how it goes:

      =IF(AND(A1>=0.2, A1<0.4, B1>=2, B1<4), "Buy", IF(AND(A1<=-0.2, A1>-0.4, B1<=-2, B1>-4), “Sell”, “”))

      Best,
      Radu

  • Hi,
    Aaagh! I need help.
    I have a formula: =IF(G4>8, (G4-8)*I4 + (8*H4), G4*H4)
    But now I want to add if H4=0 then multiply H4 by J4
    G4 is amount of hours, H4 is hourly rate, I4 is overtime rate, J4 is a new rate

    • Hi Anna,

      Where do you want to add the second condition to be checked? It’s not clear from your question. Also, if you multiply H4 by J4 you will just get 0 if H4=0. If I am to provide a solution I will need a bit more details on how you want the formula to work.

      Cheers,
      Radu

  • Hi,
    I need help with the formula:

    If percentage is less than 100% and the Go Live Date is in the future = “Ongoing”
    If percentage is less than 100% and the Go Live Date is in the past = “Late”
    If percentage is = 100% then we are done no matter if the Go live date is past or future.

    Please help. Thank you, Ana

    • Hi Ana,

      Sorry for the late reply. Give this a try and let me know how it goes. Replace cells A1 and B1 with your Percentage and Go Live Date.

      =IF(A1=100%, “Done”, IF(AND(A1<100%, B1>TODAY()), “Ongoing”, IF(AND(A1<100%, B1

  • Hello!

    First of all well done for the article, very clear and easy to follow.

    Not sure if this comment section is still action but I was wondering if you could help?

    I have this formula which is pretty much the same principle, and works:

    =IFNA(IF(AND(OR(C9=”sale”, C9=”credit”), S9=”approved”, OR(K9=”EUR”, K9=”USD”)), INDEX(Report!X:X, MATCH(Transactions!F9, Report!L:L,0)), 0), L9/’FX Rate’!$N$3)

    If C9 is sale or credit and S9 is approved, and K9 is EUR or USD, use index match to find the same transaction from another sheet (Transactions), and get me column X from this sheet. If not found, take L0 and divided by an exchange rate found in sheet FX Rate.
    Sorry I know it is a bit complex or specific. I now need to add in addition to the above, that if C9 is “refund” or “debit”, I do the the same lookup but get the result in column X in negative, so I did this :

    =(IFNA(IF(AND(OR(C9=”sale”, C9=”credit”), S9=”approved”, OR(K9=”EUR”, K9=”USD”)), INDEX(Report!X:X, MATCH(Transactions!F9, Report!L:L, 0)), 0), L9/’FX Rate’!$N$3)), (IFNA(IF(AND(OR(C9=”refund”, C9=”debit”), S9=”approved”, OR(K9=”EUR”, K9=”USD”)), INDEX(-Report!X:X, MATCH(Transactions!F9, Report!L:L, 0)), 0), -L9/’FX Rate’!$N$3))

    I am getting an error that the formula is missing an opening or closing parenthesis. I know that perhaps I joined the formulae incorrectly but I can’t figure it out.

    • Hi Denise,

      The issue you are facing is that you can’t simply merge two IFNA formulas with a comma. What I would suggest instead is to use IFNA only to check if the INDEX-MATCH formula is unable to find an exact match and join everything together in an IF statement, like this:

      =IF(first_conditions_sale, IFNA(index-match, L9/’FX Rate’!$N$3), IF(second_conditions_refund, IFNA(index-match, -L9/’FX Rate’!$N$3), “default_value_if_false”)

      I hope this helps.

  • Compute the One-Time SG50 Bonus.
    If Years of Experience is more than 10 years and Basic Salary is less than $3000
    and Sales Region is Bishan,
    then One-Time SG50 Bonus = $1,000
    Else If Years of Experience is more than 10 years and Basic Salary is less than $3000
    and Sales Region is other region,
    then One-Time SG50 Bonus = $500
    Else One-Time SG50 Bonus = 0

    • Hi Gwen,

      Sorry for the late reply. I’ve been away on holiday and didn’t get a chance to reply until today. Try this formula and let me know if it works. Replace cells A1, B1, and C1 with your own cells.

      =IF(AND(A1>10, B1<3000, C1="Bishan"), 1000, IF(AND(A1>10, B1<3000, C1<>“Bishan”), 500, 0))

  • HI,
    I just used your if statements with a small modification. I am trying to find the following
    if age<18 then code as "17, code as “18+ yrs old”, if age is missing then code as missing (blank). I tried the following= =IF(X2806>17, “18+ yrs old”, IF(X2806<18, "< 18 yrs old", " ")) but all the cells that were missing in column X came back as <18 yrs old.
    Your help would be appreciated.

    • Hi Anna,

      Sorry for the late reply. You are getting this behavior because Excel sees blank cells as zeros. So in your cars, 0 is smaller than 18, which returns TRUE. The workaround is to use the ISBLANK function, which checks if a cell is blank. Try this formula instead:

      =IF(ISBLANK(X2806), “”, IF(X2806<18, "above 18 yrs old", IF(X2806>18, “18+ yrs old”)))

  • Hey Radu,

    Have a bit of a different question here,

    So my J5=”H” K5=”L” to start with, and I Have 4 different outcomes H H = Star, H L=Plough, L H = Puzzle and L L = Dog.

    How would I use if formula to set those 4 values down the column?

    Thank you,

    Kirill

    • Hi Kirill,

      If my understanding is correct, the following formula should solve your problem:

      =IF(AND(J5=”L”, K5=”L”), “Dog”, IF(AND(J5=”H”, K5=”H”), “Star”, IF(AND(J5=”H”, K5=”L”), “Plough”, IF(AND(J5=”L”, K5=”H”), “Puzzle”, “”))))

      Let me know if it works as intended.

      Best,
      Radu

  • I am trying to write a formula that would tell me if something is complete.
    1. If column “G” is TRUE then column “F” needs to have a “DATE” (any date say larger than 1/1/2000) in it, then if column “I” is FALSE I can mark column “L” Yes
    2. If column “G” is FALSE, I can mark column “L” Yes
    3. If column “G” is TRUE then column “F” needs to have a “DATE” (any date say larger than 1/1/2000) in it, then if column “I” is TRUE then column “H” needs a “DATE” (any date say larger than 1/1/2000) in it, then I can mark column “L” Yes
    4. If column “J” has a “DATE” (any date say larger than 1/1/2000) in it that trumps all the other columns and I can mark column “L” Yes

    • Hi Jesse,

      I hope I didn’t miss any of the conditions:

      =IF(J1>DATE(2000, 1, 1), “Yes”, IF(AND(G1=TRUE, F1>DATE(2000, 1, 1), I1=FALSE, ISBLANK(I1)=FALSE), “Yes”, IF(G1=FALSE, “Yes”, IF(AND(G1=TRUE, F1>DATE(2000, 1, 1), I1=TRUE, H1>DATE(2000, 1, 1)), “Yes”))))

      Let me know how it goes.

      Radu

  • The material is comparatively easy to follow and understand. Looking forward to learning more in excel

    • Hi Emmanuel,

      Thank you for the feedback. It’s always nice to see that people find the tutorials easy to follow 🙂

      All the best,
      Radu

  • Hi, Can you please help with an IF formula.

    I have a cell in excel (F2, which has a drop down data validation of YES, NO) so a user can select either of these. In the next to this I need the cell to display the following.

    If F2=Yes then display £250 in the cell
    If F2=No then display £200 in the cell
    If F2=Other then display £0 in the cell

    =IF(F2=“yes”, 250, IF(F2=“no”, 200, IF(F2=”other”, 0)))
    But im getting an error message. Any ideas?

    Not trying to type a formula?
    When the first character is an equal (“=”) or minus (“-“) sign, Excel thinks it’s a formula:

    • you type: =1+1, cell shows: 2

    To get around this, type an apostrophe ( ‘ ) first:

    • you type: ‘=1+1, cell shows: =1+1

    • Hi Jeremy,

      I have tested the formula below and it works as intended.

      =IF(F2=”yes”, 250, IF(F2=”no”, 200, IF(F2=”other”, 0)))

      Are you using any regional settings that require the arguments to be separated by a semicolon (;) instead of a comma (,)?

  • Hi Radu

    I have a requirement to calculate the following, and have 3 potential outcomes, either to use a calculated value, an upper limit or a lower limit.

    For simplicity, the calculated value is cell A1, the upper limit is cell A2 and lower limit is cell A3

    The upper limit = 4, the lower limit = 1 (these values do not change)

    If my calculated value in cell A1 > 4 then use 4, if the calculated value is less than 4 but greater than 1, then use the calculated value, if the calculated value is less than 1, then return 1

  • Hi Radu,

    Good day to you.
    I have this requirement whereby we need to provide credit (%) for certain sales figures.

    If the sale figures in a cell is
    1. $10m <= Figure < $20m, credit of 1% of $10m-$20m to be provided.
    2. $20m <= Figure $30m, credit of 3$ of => $30m to be provided.

    How do I return the credit % value based on the above requirement?
    Thank you in advance.

    • Hi JT,

      I’m not sure I got the figures right for each tier, so feel free to adjust them. Also, I considered all sales below $10m with 0% credit value.

      =IF(AND(A1>=10000000, A1<20000000), A1*1%, IF(AND(A1>=20000000, A1<30000000), A1*2%, IF(A1>=30000000, A1*3%, 0)))

      I’ve used cell A1 as the reference for the sales figure.

      Let me know if this is what you meant.

  • Hi Radu,

    I’m trying to work out a nested IF statement for the following conditions in a range of cells,
    between the options of “Yes”, “No” and “Mostly”

    1.If all answers “Yes” then “Doing Our Job”
    2.If atleast one “No”then “Unacceptable” if not “Underperforming”

    Could you please help me with this?

    • Hi Raveena,

      Sorry for the late reply. I tried to figure out exactly how you want the formula to work. I’m not sure I got it right, but here is the formula I came up with:
      =IF(COUNTA(A1:A4)= COUNTIF(A1:A4, “Yes”), “Doing Our Job”, IF(COUNTIF(A1:A4, “No”)>0, “Unacceptable”, IF(COUNTIF(A1:A4, “Mostly”)>0, “Underperforming”, “”)))

      The formula checks if all cells are Yes and returns Doing Our Job if true. If at least one cell contains No, then it returns Unacceptable. If one or more cells contain Mostly and there is no cell that contains No, then the formula returns Underperforming.

  • Can you please help me to update this formula to add a third option, that would have the cell change to “N/A” if “Not received” was entered into cell N1? Currently, a date is entered into N1, and then “Draft Submitted” comes up; however we do not always have a draft.

    =IF(ISBLANK(N1), M1-N$1, “Draft Submitted”)

    • Hi Kelly,

      Sorry for the late reply but I was out of town for a few days. I am not sure what you are the condition M1-N1 should display if cell N1 is blank, but the formula that would work based on your criteria is this:
      =IF(N1=”Not received”, “N/A”, IF(ISBLANK(N1), M1-N$1, “Draft Submitted”))

      I hope this works as you want.

  • I have been trying to pull data set up for a March Madness type of sheet. One of the brackets is in between 3 teams.. So when trying to get the winner to pull to the new bracket it is telling me too many arguments. Could you help?

    What i have been putting

    =IF(AND(S79< S71, S85, T79, IF(S71< S79, S85, T71, IF(S85< S79, S72, T85, “”)))

    The original between 2 winners works fine which is

    =IF(S62< S56, T62, IF(S56< S62, T56, “”))

    • Hi Tina,

      I am not sure what conditions you are trying to set. I can quickly spot that you have syntax errors in your formula. I will list them one by one below.

      1. Your AND() statement closes at the end of the formula. This means that Excel is trying to check all the conditions nested inside the AND statement and has no value_if_true of valur_if_false to return in your IF statement.
      2. Your second IF statement has four arguments when you can only supply a maximum of 3. The third IF statement is still inside the second IF statement and is considered an argument.
      3. Your third IF statement has four arguments as well. You have the condition S85

  • >