Excel Nested IF statement: examples, best practices and alternatives

The tutorial explains how to use the nested IF function in Excel to check multiple conditions. You will also learn a few other functions that could be good alternatives to using a nested formula in Excel.

How do you usually implement a decision-making logic in your Excel worksheets? In most cases, you'd use an IF formula to test your condition and return one value if the condition is met, another value if the condition is not met. To evaluate more than one condition and return different values depending on the results, you nest multiple IFs inside each other.

Though very popular, the nested IF statement is not the only way to check multiple conditions in Excel. In this tutorial, you will find a handful of alternatives that are definitely worth exploring.

Excel nested IF statement

Here's the classic Excel nested IF formula in a generic form:

IF(condition1, result1, IF(condition2, result2, IF(condition3, result3, result4)))

You can see that each subsequent IF function is embedded into the value_if_false argument of the previous function. Each IF function is enclosed in its own set of parentheses, but all the closing parentheses are at the end of the formula.

Our generic nested IF formula evaluates 3 conditions, and returns 4 different results (result 4 is returned if none of the conditions is TRUE). Translated into a human language, this nested IF statement tells Excel to do the following:

Test condition1, if TRUE - return result1, if FALSE -
test condition2, if TRUE - return result2, if FALSE -
test condition3, if TRUE - return result3, if FALSE -
return result4

As an example, let's find out commissions for a number of sellers based on the amount of sales they've made:

Commission Sales
3% $1 - $50
5% $51 - $100
7% $101 - $150
10% Over $150

In math, changing the order of addends does not change the sum. In Excel, changing the order of IF functions changes the result. Why? Because a nested IF formula returns a value corresponding to the first TRUE condition. Therefore, in your nested IF statements, it's very important to arrange the conditions in the right direction - high to low or low to high, depending on your formula's logic. In our case, we check the "highest" condition first, then the "second highest", and so on:

=IF(B2>150, 10%, IF(B2>=101, 7%, IF(B2>=51, 5%, IF(B2>=1, 3%, ""))))
Excel nested IF statement

If we placed the conditions in the reverse order, from the bottom up, the results would be all wrong because our formula would stop after the first logical test (B2>=1) for any value greater than 1. Let's say, we have $100 in sales - it is greater than 1, so the formula would not check other conditions and return 3% as the result.

If you'd rather arrange the conditions from low to high, then use the "less than" operator and evaluate the "lowest" condition first, then the "second lowest", and so on:

=IF($B2<1, 0%, IF($B2<51, 3%, IF($B2<101, 5%, IF($B2<=150, 7%, 10%))))

As you see, it takes quite a lot of thought to build the logic of a nested IF statement correctly all the way to the end. And although Microsoft Excel allows nesting up to 64 IF functions in one formula, it is not something you'd really want to do in your worksheets. So, if you (or someone else) are gazing at your Excel nested IF formula trying to figure out what it actually does, it's time to reconsider your strategy and probably choose another tool in your arsenal.

For more information, please see Excel nested IF statement.

Nested IF with OR/AND conditions

In case you need to evaluate a few sets of different conditions, you can express those conditions using OR as well as AND function, nest the functions inside IF statements, and then nest the IF statements into each other.

Nested IF in Excel with OR statements

By using the OR function you can check two or more different conditions in the logical test of each IF function and return TRUE if any (at least one) of the OR arguments evaluates to TRUE. To see how it actually works, please consider the following example.

Supposing, you have two columns of sales, say January sales in column B and February sales in column C. You wish to check the numbers in both columns and calculate the commission based on a higher number. In other words, you build a formula with the following logic: if either Jan or Feb sales are greater than $150, the seller gets 10% commission, if Jan or Feb sales are greater than or equal to $101, the seller gets 7% commission, and so on.

To have it done, write a few OF statements like OR(B2>150, C2>150) and nest them into the logical tests of the IF functions discussed above. As the result, you get this formula:

=IF(OR(B2>150, C2>150), 10%, IF(OR(B2>=101, C2>=101),7%, IF(OR(B2>=51, C2>=51), 5%, IF(OR(B2>=1, C2>=1), 3%, ""))))

And have the commission assigned based on the higher sales amount:
Nested IF with multiple OR conditions

For more formula examples, please see Excel IF OR statement.

Nested IF in Excel with AND statements

If your logical tests include multiple conditions, and all of those conditions should evaluate to TRUE, express them by using the AND function.

For example, to assign the commissions based on a lower number of sales, take the above formula and replace OR with AND statements. To put it differently, you tell Excel to return 10% only if Jan and Feb sales are greater than $150, 7% if Jan and Feb sales are greater than or equal to $101, and so on.

=IF(AND(B2>150, C2>150), 10%, IF(AND(B2>=101, C2>=101), 7%, IF(AND(B2>=51, C2>=51), 5%, IF(AND(B2>=1, C2>=1), 3%, ""))))

As the result, our nested IF formula calculates the commission based on the lower number in columns B and C. If either column is empty, there is no commission at all because none of the AND conditions is met:
Nested IF with AND statements

If you'd like to return 0% instead of blank cells, replace an empty string (''") in the last argument with 0%:

=IF(AND(B2>150, C2>150), 10%, IF(AND(B2>=101, C2>=101), 7%, IF(AND(B2>=51, C2>=51), 5%, IF(AND(B2>=1, C2>=1), 3%, 0%))))
Nested IF with multiple AND conditions

More information can be found here: Excel IF with multiple AND/OR conditions.

VLOOKUP instead of nested IF in Excel

When you are dealing with "scales", i.e. continuous ranges of numerical values that together cover the entire range, in most cases you can use the VLOOKUP function instead of nested IFs.

For starters, make a reference table like shown in the screenshot below. And then, build a Vlookup formula with approximate match, i.e. with the range_lookup argument set to TRUE.

Assuming the lookup value is in B2 and the reference table is F2:G5, the formula goes as follows:

=VLOOKUP(B2,$F$2:$G$5,2,TRUE)

Please notice that we fix the table_array with absolute references ($F$2:$G$5) for the formula to copy correctly to other cells:
VLOOKUP instead of nested IF in Excel

By setting the last argument of your Vlookup formula to TRUE, you tell Excel to search for the closest match - if an exact match is not found, return the next largest value that is smaller than the lookup value. As the result, your formula will match not only the exact values in the lookup table, but also any values that fall in between.

For example, the lookup value in B3 is $95. This number does not exist in the lookup table, and Vlookup with exact match would return an #N/A error in this case. But Vlookup with approximate match continues searching until it finds the nearest value that is less than the lookup value (which is $50 in our example) and returns a value from the second column in the same row (which is 5%).

But what if the lookup value is less than the smallest number in the lookup table or the lookup cell is empty? In this case, a Vlookup formula will return the #N/A error. If it's not what you actually want, nest VLOOKUP inside IFERROR and supply the value to output when the lookup value is not found. For example:

=IFERROR(VLOOKUP(B2, $F$2:$G$5, 2, TRUE), "Outside range")

Important note! For a Vlookup formula with approximate match to work correctly, the first column in the lookup table must be sorted in ascending order, from smallest to largest.

For more information, please see Exact match VLOOKUP vs. approximate match VLOOKUP.

IFS statement as alternative to nested IF function

In Excel 2016 and later versions, Microsoft introduced a special function to evaluate multiple conditions - the IFS function.

An IFS formula can handle up to 127 logical_test/value_if_true pairs, and the first logical test that evaluates to TRUE "wins":

IFS(logical_test1, value_if_true1, [logical_test2, value_if_true2]...)

In accordance with the above syntax, our nested IF formula can be reconstructed in this way:

=IFS(B2>150, 10%, B2>=101, 7%, B2>=51, 5%, B2>0, 3%)

Please pay attention that the IFS function returns the #N/A error if none of the specified conditions is met. To avoid this, you can add one more logical_test/value_if_true to the end of your formula that will return 0 or empty string ("") or whatever value you want if none of the previous logical tests is TRUE:

=IFS(B2>150, 10%, B2>=101, 7%, B2>=51, 5%, B2>0, 3%, TRUE, "")

As the result, our formula will return an empty string (blank cell) instead of the #N/A error if a corresponding cell in column B is empty or contains text or negative number.
Excel IFS statement to handle multiple conditions

Note. Like nested IF, Excel's IFS function returns a value corresponding to the first condition that evaluates to TRUE, which is why the order of logical tests in an IFS formula matters.

For more information, please see Excel IFS function instead of nested IF.

CHOOSE instead of nested IF formula in Excel

Another way to test multiple conditions within a single formula in Excel is using the CHOOSE function, which is designed to return a value from the list based on a position of that value.

Applied to our sample dataset, the formula takes the following shape:

=CHOOSE((B2>=1) + (B2>=51) + (B2>=101) + (B2>150), 3%, 5%, 7%, 10%)

In the first argument (index_num), you evaluate all the conditions and add up the results. Given that TRUE equates to 1 and FALSE to 0, this way you calculate the position of the value to return.

For example, the value in B2 is $150. For this value, the first 3 conditions are TRUE and the last one (B2 > 150) is FALSE. So, index_num equals to 3, meaning the 3rd value is returned, which is 7%.
Using CHOOSE instead of nested IF formula in Excel

Tip. If none of the logical tests is TRUE, index_num is equal to 0, and the formula returns the #VALUE! error. An easy fix is wrapping CHOOSE in the IFERROR function like this:

=IFERROR(CHOOSE((B2>=1) + (B2>=51) + (B2>=101) + (B2>150), 3%, 5%, 7%, 10%), "")

For more information, please see Excel CHOOSE function with formula examples.

SWITCH function as a concise form of nested IF in Excel

In situations when you are dealing with a fixed set of predefined values, not scales, the SWITCH function can be a compact alternative to complex nested IF statements:

SWITCH(expression, value1, result1, value2, result2, …, [default])

The SWITCH function evaluates expression against a list of values and returns the result corresponding to the first found match.

In case, you'd like to calculate the commission based on the following grades, rather than sales amounts, you could use this compact version of nested IF formula in Excel:

=SWITCH(C2, "A", 10%, "B", 7%, "C", 5%, "D", 3%, "")

Or, you can make a reference table like shown in the screenshot below and use cell references instead of hardcoded values:

=SWITCH(C2, $F$2, $G$2, $F$3, $G$3, $F$4, $G$4, $F$5, $G$5, "")

Please notice that we lock all references except the first one with the $ sign to prevent them from changing when copying the formula to other cells:
SWITCH function - a compact form of a nested IF formula in Excel

Note. The SWITCH function is only available in Excel 2016 and higher.

For more information, please see SWITCH function - the compact form of nested IF statement.

Concatenating multiple IF functions in Excel

As mentioned in the previous example, the SWITCH function was introduced only in Excel 2016. To handle similar tasks in older Excel versions, you can combine two or more IF statements by using the Concatenate operator (&) or the CONCATENATE function.

For example:

=(IF(C2="a", 10%, "") & IF(C2="b", 7%, "") & IF(C2="c", 5%, "") & IF(C2="d", 3%, ""))*1

Or

=CONCATENATE(IF(C2="a", 10%, ""), IF(C2="b", 7%, ""), IF(C2="c", 5%, "") & IF(C2="d", 3%, ""))*1
Concatenating multiple IF functions in Excel

As you may have noticed, we multiply the result by 1 in both formulas. It is done to convert a string returned by the Concatenate formula to a number. If your expected output is text, then the multiplication operation is not needed.

For more information, please see CONCATENATE function in Excel.

You can see that Microsoft Excel provides a handful of good alternatives to nested IF formulas, and hopefully this tutorial has given you some clues on how to leverage them in your worksheets. To have a closer look at the examples discussed in this tutorial, you are welcome to download our sample workbook below. I thank you for reading and hope to see you on our blog next week!

Practice workbook for download

Excel nested If statement - examples (.xlsx file)

122 comments

  1. I have a spreadsheet that has a column for name, active date and inactive date. I need to somehow do a count of users that were active during a certain month. For example, I need to know how many users were active in say, June 2024. According to the data below, the first 4 should be counted (test 2 and 3 is still active). Test 5 wouldn't be counted because they left in May. I have no idea how to write a formula for that. Can anyone help?
    A) B) C)
    Name Active date Inactive Date
    Test 11/15/23 06/15/24
    Test2 09/28/23
    Test3 05/11/24
    Test4 12/06/23 08/15/24
    Test5 01/15/24 05/03/24

  2. Hi!

    The following nested IF formula is skipping over the third and fourth lines if the second line returns an #N/A. I've tried alternative approaches (i.e., CHOOSE, etc.) which didn't work either. The basic idea is for the cell to display a certain text given the appearance of a cell reference within specific lists which are located on disparate Sheets. For future maintenance, I wish to avoid utilizing VLOOKUP. The data have all been formatted as Text.

    =IFNA(IF('FAF Queues'!E2="","",
    IF('Queues'!E2=INDEX('State 1 Full'!A:A, MATCH('Queues'!E2, 'State 1 Full'!A:A, 0)), "State 1",
    IF('Queues'!E2=INDEX('State 1 Custom'!A:A, MATCH('Queues'!E2, 'State 1 Custom'!A:A, 0)), "Custom",
    IF('Queues'!E2=INDEX('State 2 Full'!A:A, MATCH('Queues'!E2, 'State 2 Full'!A:A, 0)), "State 2", "Non Urgent")))),
    "Not working")

    Is there a way to ensure each nested IF is processed in succession, despite the #N/A being returned? #N/A occurs whether or not I use the IFNA piece of the formula.

    Thank you!

    1. Correction to formula to reduce confusion:

      =IFNA(IF('Queues'!E2="","",
      IF('Queues'!E2=INDEX('State 1 Full'!A:A, MATCH('Queues'!E2, 'State 1 Full'!A:A, 0)), "State 1",
      IF('Queues'!E2=INDEX('State 1 Custom'!A:A, MATCH('Queues'!E2, 'State 1 Custom'!A:A, 0)), "Custom",
      IF('Queues'!E2=INDEX('State 2 Full'!A:A, MATCH('Queues'!E2, 'State 2 Full'!A:A, 0)), "State 2", "Non Urgent")))),
      "Not working")

      **NOTE: "Not working" is simply being used to identify the instances of #N/A, and it will be changed if this ends up working.

  3. Hi, I am trying to get my formula to work. The end result would be if a1 > b1 then "apple". if b1> c1 then "orange" and if c1> a1 then " pineapple" however., I seem to get stuck when in the second row. my current formula is =IF(A>B1,"APPLE",IF(B1>A1,"ORANGE",IF(C1>B1,"PINEAPPLE",IF(A1>C1,"APPLE",IF(B1>C1,"ORANGE",IF(C1>A1,"Packout"))))))

    1. Hi! In your case, several conditions can be executed simultaneously. So pay attention to this paragraph: Nested IF with OR/AND conditions. It is impossible to correct your formula, because you have not described these conditions.

  4. Hello and thank you for great content! I'm having problems with my formula. In one cell I have an answer (C33="Yes"). In another cell (B32) I have a number value. The returned value differs based on the number value in cell B32. The formula pulls in the correct value for the very first condition where B32<65%. Every statement after the first one doesn't seem to work. When I enter a value of 65% or greater in B32 it just returns 0. Should I be using a different formula? Thank you for any help you can provide.

    =IF(AND(C33="Yes",B32<65%),Values!V4, IF(AND(C33="Yes",65%<B32<75%),Values!V5, IF(AND(C33="Yes",75%<B32<80%),Values!V6, IF(AND(C33="Yes",80%<B32<85%),Values!V7, IF(AND(C33="Yes",85%<B32<90%),Values!V8, IF(AND(C33="Yes",90%<B32<95%),Values!V9,0))))))

    1. I figured it out! Well, actually, my husband did. For anyone reading, the issue was that the B32 range wasn't recognized (i.e. 65%<B32<75%). Using this same example, since the condition for the value up to 65% is already accounted for in the previous condition, only B32<75% needs to be written in the next condition. Still open to simplifications to this formula if any exist. Thanks!

      1. Hi Alexander, I didn't refresh my browser so I didn't see your reply until after posting the solution we found. Thank you for taking a look!

  5. I am trying to write a formula that references a date range based on age that will return a value from a list of values to calculate a certain premium amount.

    For example if the person is aged 54.85 then I need to return a value of 0.43 (the table reference is G$28) which is is the age range of 50 and less than 55 - i have written the following formula but it is not working for me at all

    =IF(AND(F5=25,F5=29,F5=35,F5=40,F5=45,F5=50,F5=55,F5=60,F5=65,F570,G$32))))

    and I have tried it this way

    =IF(IF(F4=25,F4=30,F4=35,F4=40,F4=45,F4=50,F4=55,F4=60,F4=65,F470,G$32))))

  6. Hi all,
    I am trying to nest a lot of if statements together, some are just "if then", others are "if then else".
    I am having difficulty with the syntax.
    I can see you can use concatenate to combine multiple "if then else" statements together, but what if I wanted to combine a mix of "if then", "if then", "if then else", "if then else" for example.
    I keep getting a "too many arguments" error
    The details aren't important, just the syntax.
    My example is :
    =If(M7="Commencement",1500,IF(M7="Recommencement",750,IF(AND(M7="BAC 1st Qtr",O4*.5>7000),7000,O4*.5,IF(AND(M7="BAC 1st Qtr",O4*.5>4000),4000,O4*.9))))
    I appreciate any assistance

    1. Hi! Pay attention to this part of the formula.

      IF(AND(M7="BAC 1st Qtr",O4*.5>7000),7000,O4*.5, IF....

      This IF has two FALSE arguments.
      If you have many IF arguments, I recommend using the IFS function.

  7. Good day,

    I have a report that I do daily, we have daily figures which are to be reported as they change, then the MTD figures which are added up, now in the dashboard sheet, I need to automate such that, when the date changes (set =TODAY()), then the "daily update" columns must pick from that particular day..I don't want use the IF function as it becomes too long.

    Any alternative formula?

  8. The company categorizes all its staff as follows; all those who earns 900000 and above are categorized as Management, those who earn 800000 and above but below 900000 are termed as experts, those earning 700000 and above but below 800000 are called technical staffs and the rest are categories as Support staffs. Using a good Excel function, attach a category to each staff using the scenarios listed above.

    Can someone help me with this if formula example?

  9. Hi, I need to add a margin percentage based on a formula where our margin decreases for more expensive products, how do I do that.

    i.E. a product is 5000 to 5999 = 32% margin and product that 6000 to 6999 is 31% margin?

    from to gp
    0 4999 33
    5000 5999 32
    6000 6999 31
    7000 7999 30
    8000 9999 29
    10000 29999 28
    30000 100000 27

  10. Cell C9 contains a number whose value depends on the contents of cell B9. The inputter can either put a number in cell B9 or they can write the word "none" (without quotes)
    None should be interpreted as 0 (in cell C9). If they write any other word cell C9 should display "check value, it must be a number or write the word none"
    If cell B9 has a number less than 40 then c9 =B9*4 but if B9>40 then c9 = B9*50.

    When I only use numbers it all works out OK. If I am only looking at text strings, everything works ok but the moment I combine them in an IF statement it fails with #Value!

    I would be grateful for your advice.

    1. I meant >= 40 for the second part
      so B9 =40 the c9=b9*50

  11. I'm struggling with a complex formula and would appreciate someone's expertise on this. This is the formula that I created for my worksheet and I know the first portion is correct, however, it is the last piece regarding Medely that is not correct.

    =IF(A21="NurseDash",A21="ShiftKey",G21*H21),IF(A21="Medely",(G218),(G21*H21)+(H21*1.5)*(G21-8))

    I'm attempting to have the worksheet calculate the correct bill rate based on overtime paid to an agency staff.
    I need it to calculate like this:
    If A21 = Medely
    Then look at the totals hours worked in G21.
    If they are 8 hours or less, then multiply G21 by H21.
    If they are more than 8 hours, then multiply the first 8 hours by H21, then multiply the hourly rate in H21 by 1.5 then sum these two products.

    1. Hi!
      I don't think the first part of your formula is correct. But I don't have information to fix it. The calculation will be like this -

      =MIN(G21,8)*H21+MAX(G21-8,0)*H21*1.5

      If one of the conditions must be met, then pay attention to this article: Excel IF OR statement.

  12. Hello,

    I'm struggling with two nested IF AND ORs, each works on its own but putting them together fails. I've tried all sort of combinations, IF AND, IF AND OR, no dice.

    Need to check if cell A1 has value of 2 and if cell B1 is greater than or equal to 85, if yes "Good" if no "bad"
    also need to check if A1 has value of 4 and cell B1 is greater than or equal to 65, if yes "Good" if no "Bad"

    =IF(AND(A1=2,B1 > = 85),"Good","Bad"),IF(AND(A1=4,B1 > = 65),"Good","Bad"))

    1. Try:

      =IF(OR(AND(A1=2,B1 > = 85),AND(A1=4,B1 > = 65)),"Good","Bad")

    2. Hi!
      It is impossible to combine your conditions in one formula, as they contradict each other. If the second condition returns Yes, then for the same values the first condition returns No.

  13. Hi,
    I have this question on nested if, if the net cost is less than $0, performance should be "BAD". Otherwise, if the net cost is less than $150 the performance should be "ACCEPTABLE". Otherwise, the performance should be "GOOD"
    Net Income is in H14:H44

    I used =IF(H14<0, "BAD", IF(H14<150, "ACCEPTABLE", " GOOD"))

  14. Hi, sir thank you for the information you give us about excel. I have a question.

    Develop only one formula (drag & drop) starting from cell C8 until cell C13.
    The conditions are as the followings
    1) if the last cell for each row is greater or equal to the value of the previous cell (the result is Yes)
    2) if the last cell for each row is less than the value of the previous cell; then, (the result is No)

    In row 1, cell K1 has the value 3, cell J1 has 1
    In row 2, cell J2 has the value 2, cell I2 has 6
    In row 3, cell I3 has the value 8, cell H3 has 8
    In row 4, cell H4 has the value 1, cell G4 has 2
    In row 5, cell F5 has the value 2, cell E5 has 3
    In row 2, cell I6 has the value 8, cell H6 has 6

    The above mentioned is a table. The values are in multiple columns. I need the answer in a single column.

    Thanks
    Regard

    1. Hi!
      To find the last number in a row, use the INDEX+MATCH functions:

      =INDEX(A1:M1,0,MATCH(E1+306,A1:M1,1))

      You can get the number in the cell on the left with the formula:

      =INDEX(A1:M1,0,MATCH(E1+306,A1:M1,1)-1)

      Use the IF function to compare these values and return "Yes" or "No".

  15. Ablebits Team, thank you for the information you have on here, so wonderful. I'm looking for a formula which would match a person to a scheduled job at a particular time. The conditions for a person to be assigned to the job are; the person has to have a particular rating in order to do the job, the named person should be available for the job for the time slot (not blocked) and one person can do multiple jobs so long as he has the correct rating and he's available. This is a sports official kind of job assignment. I'm basically trying to match about fifty officials to about one hundred games (and all of the officials should get at least one game) and I wondered if excel would be able to help me by cutting down on the amount of time.

    Thank you and I look forward to your response.

    1. Hi!
      This is a complex solution that cannot be found with a single formula. If you have a specific question about the operation of a function or formula, I will try to answer it.

      1. Many thanks and I really appreciate the response.

  16. Hi,

    You have been so helpful with one of my previous questions. Can you tell me why this formula isn't working please? =if(OR(H2="GSD",H2="GR x L"), K2+N3, K2+N4). In the column H there are lots of variations of words, I'd like the formula to check for 3 variations of these words e.g. GSD or GR x L and if it finds them to then add time in N3 to a date held in K2. If it doesn't find that combination of words I really just want it to just show the same information in K2 without adding anything on (but have added a zero in n4 so it does something. Hope that makes sense! Thank you

      1. Hi Alexander, What I want to happen is....If the cell H2 contains 3 possible selection of words eg 'GSD', 'GSD xL' that the cell with the formula in looks at a date in K2 and and adds on time which is held in N3. If it doesn't find those words, it doesn't add time to the date and just shows the same date as already shown in K2. I've tried to account for the 'if not' part by adding on 0 which is held in N4 but not sure I need that. Hope that makes more sense.

        1. Hi!
          The formula checks the 2 conditions you specified. She works correctly. What don't you like about her work?

          1. Thanks Alexander, the formula doesn't seem to be working. as nothing changes. Could it be because I'm trying to look for 3 different sets of words? So it would be 'GSD' or 'GSD x L' not all of them?

            1. Hi!
              I think we are talking about different things. Write some examples of source data and the desired result.

              1. Source data
                in column H it could read "GSD", or "GSD x L", or " L x GSD", or "GR"
                in column K there are a load of dates e.g. 16/06/21, or 05/03/21
                in cell N3 there is the number 429 and in N4 there is the number 0
                I would like a formula that looks at the text in column H and if it finds the text "GSD", "GSD xL", or "L X GSD" then it adds time on (N3 = 429) to the date held in column K and displays this as a new date. If it doesn't find that text it adds on nothing (n4 - 0) to the date - so just replicates the date in already in column K.
                Sorry, I'm probably not being very clear. I really appreciate your time!

              2. Hi!
                If I understand correctly, one more condition needs to be added to the IF formula with OR conditions.

                =IF(OR(H2="GSD",H2="GR x L",H2="L X GSD"), K2+$N$3, K2+$N$4)

                If you are looking for this text as part of the text in a cell, then use the SEARCH function.

                =IF(SUM(--ISNUMBER(SEARCH({"GSD","GR x L","L X GSD"},H2)))>0, K2+$N$3, K2+$N$4)

                I hope it’ll be helpful.

  17. Thanks for the info,

    However, in your first illustration, what do we do if, for instance; in the sales column B5 and B8 are blank cells. And we want to return the commisionas unknown

    1. Hi!
      I don't really understand where is the problem here. If the sales are zero, then the commission is also zero.

  18. Hi,
    I would really appreciate assistance with this formula.

    I have a cell A51 that can contain one of three words "receipt", "contract", "invoice"

    If cell A51 says receipt I need cell L51/0,8775
    If cell A51 says contract I need cell L51*38%
    If cell A51 says invoice I need cell L51*0,19

    This is the formula I have tried (amongst numerous attempts)
    =IF(I51="receipt",L51/0,8775,IF(I51="contract",L51*38%,IF(I51="invoice",L51*0,19,)))

    1. Hi!
      Use the correct separators in the formula

      =IF(I51="receipt",L51/0.8775,IF(I51="contract",L51*38%,IF(I51="invoice",L51*0.19,"")))

      1. Thank you,
        I realised I also had to change the comas to semicolons because it's a Spanish/French template

  19. Respected Sir,
    I have learned from your above blog regarding nested if function in excel. In your first example the formula shown in screenshot doesn't meet the criteria condition mentioned in blog. Instead the formula should be like "=IF($B2>=151, 10%, IF($B2>=101, 7%, IF($B2>51, 5%, IF($B2>=1, 3%, 0%))))". Secondly, I realized it doesn't make any difference in result whether you chose High to Low in your formula or Low to High. Excel never make any error in calculation or your required results. Only required condition is that you needed to write your formula correctly. I did for you like this "=IF($B2<1, 0%, IF($B2<51, 3%, IF($B2<101, 5%, IF($B2<151, 7%, 10%))))". English is not my first language so I might made some errors in text. If anything written by me hurts the feelings of anybody I do apologize with all.
    Sincere regards,
    Rehmatullah

    1. Hello Rehmatullah,

      Thank you for your feedback.

      You are right about the first formula. To meet the stated conditions precisely, the first logical test should be $B2>=151 or $B2>150.

      As for the order of conditions, we are actually talking about the same thing but in different words :) Whichever direction you choose, it is important to place the nested functions in the right order. In case of "high to low" arrangement, you use the "greater than" operator and check the highest condition first, then the second highest, and so on. In case of "low to high", you use the "less than" operator and start with testing the lowest condition, then the second lowest, etc.

  20. Hello,

    I am looking to perform a nested IF which looks a the value of two cells (column v and column an) and returns values as follows:

    If cell V2 ="Pass" show the text "Proposed" else "Requires Exam" then as part of the same if statement:
    If cell AN2 =text "Licenced" else the result of the earlier V2 result

    I am sure I am missing something obvious as so far I have tried the following:

    =IF(V2="Pass","Proposed","Requires Exam"(IF(ISTEXT(AN2),"Licenced","Result of V2="Pass","Proposed","Requires Exam"

    1. =IF(AND(V2="Pass",AN2="Licensed"),"Licensed",
      IF(AND(V2="Pass",AN2=0,"Proposed"),
      IF(AND(V2=0,AN2=0,"Requires Exam"),"")))

      1. Hi Sir, Why this if condition is not working =IF(AF="FJ",AND(AP$16>=$AG21,AP$16<=$AI21))

        1. Hello!
          The formula does not work because the conditions are written incorrectly. Check out the guidelines in this article.

    2. Can this be done with formulas or do I need to go down the VBA route?

Post a comment



Thanks for your comment! Please note that all comments are pre-moderated, and off-topic ones may be deleted.
For faster help, please keep your question clear and concise. While we can't guarantee a reply to every question, we'll do our best to respond :)