Professional Documents
Culture Documents
MS Excel: How To Use The Nested If Functions (WS)
MS Excel: How To Use The Nested If Functions (WS)
MS Excel: How To Use The Nested If Functions (WS)
Description
The IF function is a built-in function in Excel that is categorized as a Logical Function. It can be
used as a worksheet function (WS) in Excel. As a worksheet function, the IF function can be
entered as part of a formula in a cell of a worksheet.
It is possible to nest multiple IF functions within one Excel formula. You can nest up to 7 IF
functions to create a complex IF THEN ELSE statement.
TIP: If you have Excel 2016, try the new IFS function instead of nesting multiple IF
functions.
Syntax
The syntax for the nesting the IF function is:
IF condition1 THEN
value_if_true1
ELSEIF condition2 THEN
value_if_true2
ELSE
value_if_false2
END IF
https://www.techonthenet.com/excel/formulas/if_nested.php Page 1 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Parameters or Arguments
condition
The value that you want to test.
value_if_true
The value that is returned if condition evaluates to TRUE.
value_if_false
The value that is return if condition evaluates to FALSE.
Note
This Nested IF function syntax demonstrates how to nest two IF functions. You can nest
up to 7 IF functions.
Applies To
Excel for Office 365, Excel 2019, Excel 2016, Excel 2013, Excel 2011 for Mac, Excel
2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
Worksheet function (WS)
https://www.techonthenet.com/excel/formulas/if_nested.php Page 2 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Based on the Excel spreadsheet above, the following Nested IF examples would return:
=IF(A1="10x12",120,IF(A1="8x8",64,IF(A1="6x6",36)))
Result: 120
=IF(A2="10x12",120,IF(A2="8x8",64,IF(A2="6x6",36)))
Result: 64
=IF(A3="10x12",120,IF(A3="8x8",64,IF(A3="6x6",36)))
Result: 36
TIP: When nesting multiple IF functions, DO NOT start the second IF function with =
sign.
Incorrect formula:
=IF(A1=2,"Hello",=IF(A1=3,"Goodbye",0))
Correct formula
=IF(A1=2,"Hello",IF(A1=3,"Goodbye",0))
https://www.techonthenet.com/excel/formulas/if_nested.php Page 3 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Question: In Microsoft Excel, I need to write a formula that works this way:
Answer: You can write a nested IF statement to handle this. For example:
Answer: In cell C5, you can write a nested IF statement that uses the AND function as follows:
=IF((A1+B1)<=4,20,IF(AND((A1+B1)>4,(A1+B1)<=9),35,IF(AND((A1+B1)>9,
(A1+B1)<=14),50,75)))
=IF(A1="PRADIP",100,IF(A1="PRAVIN",200,IF(A1="PARTHA",300,IF(A1="PAVAN",
400,""))))
https://www.techonthenet.com/excel/formulas/if_nested.php Page 4 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Answer: You can write a nested IF statement that uses the MAX function and the MIN
function as follows:
=IF(A1<100000,MAX(25,A1*0.1%),IF(A1>1000000,MIN(5000,A1*0.01%),""))
Question: I have Excel 2000. If cell A2 is greater than or equal to 0 then add to C1. If cell B2 is
greater than or equal to 0 then subtract from C1. If both A2 and B2 are blank then equals C1.
Can you help me with the IF function on this one?
Answer: You can write a nested IF statement that uses the AND function and the ISBLANK
function as follows:
=IF(AND(ISBLANK(A2)=FALSE,A2>=0),C1+A2,
IF(AND(ISBLANK(B2)=FALSE,B2>=0),C1-B2, IF(AND(ISBLANK(A2)=TRUE,
ISBLANK(B2)=TRUE),C1,"")))
Question: How would I write this equation in Excel? If D12<=0 then D12*L12, If D12 is > 0 but
<=600 then D12*F12, If D12 is >600 then ((600*F12)+((D12-600)*E12))
=IF(D12<=0,D12*L12,IF(D12>600,((600*F12)+((D12-600)*E12)),D12*F12))
Question: I have read your piece on nested IFs in Excel, but I still cannot work out what is
wrong with my formula please could you help? Here is what I have:
=IF(63<=A2<80,1,IF(80<=A2<95,2,IF(A2=>95,3,0)))
Answer: The simplest way to write your nested IF statement based on the logic you describe
above is:
=IF(A2>=95,3,IF(A2>=80,2,IF(A2>=63,1,0)))
https://www.techonthenet.com/excel/formulas/if_nested.php Page 5 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Question: I'm very new to the Excel world, and I'm trying to figure out how to set up the
proper formula for an If/then cell.
I've tried a few different things thinking I was on the right track based on the IF, and AND
function tutorials here, but I can't seem to get it right.
Answer: To write your IF formula, you need to nest multiple IF functions together in
combination with the AND function.
The following formula should work for what you are trying to do:
As one final component of your formula, you need to decide what to do when none of the
conditions are met. In this example, we have returned "" when the value in B2 does not meet
any of the IF conditions above.
=IF(C9=1,K9/J7,IF(C9=2,K9/J7,IF(C9=3,K9/L7,IF(C9=4,0,K9/N7))))
In Cell C9, I can have an input of 1, 2, 3, 4 or 0. The problem is on how to write the "or"
condition when a "4 or 0" exists in Column C. If the "4 or 0" conditions exists in Column C I
want Column K divided by Column N and the answer to be placed in Column M and
associated row
https://www.techonthenet.com/excel/formulas/if_nested.php Page 6 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Answer: You should be able to use the OR function within your IF function to test for C9=4 OR
C9=0 as follows:
=IF(C9=1,K9/J7,IF(C9=2,K9/J7,IF(C9=3,K9/L7,IF(OR(C9=4,C9=0),K9/N7))))
Question: In Excel, I am trying to create a formula that will show the following:
If column B = Ross and column C = 8 then in cell AB of that row I want it to show 2013, If
column B = Block and column C = 9 then in cell AB of that row I want it to show 2012.
Answer: You can create your Excel formula using nested IF functions with the AND function.
=IF(AND(B1="Ross",C1=8),2013,IF(AND(B1="Block",C1=9),2012,""))
This formula will return 2013 as a numeric value if B1 is "Ross" and C1 is 8, or 2012 as a
numeric value if B1 is "Block" and C1 is 9. Otherwise, it will return blank, as denoted by "".
Question: In Excel, I really have a problem looking for the right formula to express the
following:
I've been trying to look for any same expressions in your site. Please help me fix this.
Answer: In cell C1, you can use the following Excel formula with 3 nested IF functions:
Please note that if none of the conditions are met, the Excel formula will return "" as the result.
=IF(OR(ISBLANK(C9),ISBLANK(B9)),"",IF(ISBLANK(C9),D9-TODAY(),
"Reactivated"))
https://www.techonthenet.com/excel/formulas/if_nested.php Page 7 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
I want to make an event that if B9 and C9 is empty, the value would be empty. If only C9 is
empty, then the output would be the remaining days left between the two dates, and if the two
cells are not empty, the output should be the string 'Reactivated'.
Answer: First of all, you might want to replace your OR function with the AND function, so that
your Excel IF formula looks like this:
=IF(AND(ISBLANK(C9),ISBLANK(B9)),"",IF(ISBLANK(C9),D9-
TODAY(),"Reactivated"))
Next, make sure that you don't have any abnormal formatting in the cell that contains the
results. To be safe, right click on the cell that contains the formula and choose Format Cells
from the popup menu. When the Format Cells window appears, select the Number tab.
Choose General as the format and click on the OK button.
Question: I'm looking to return an answer from a number 'n' that needs to satisfy a certain
range criteria. New stamp duty calculators for UK property set bands for percentage stamp
duty as follows:
0-125000 =0%
125001-250000 =2%
250001-975000 =5%
975001-1500000 =10%
>1500000 =12%
I realise it's probably an 'IF(AND)' function but I appear to require too many arguments. Can
you help?
Answer: You can create this formula using nested IF functions. We will assume that your
number 'n' resides in cell B1. You can create your formula as follows:
Since your IF conditions will cover all numbers in the range of 0 to >1500000, it is easiest to
work backwards starting with the >1500000 condition. Excel will evaluate each condition and
stop when a condition is TRUE. This is why we can simplify the formulas within the nested IF
functions, instead of testing ranges using two comparisons such as AND(B1>=125001,
B1<=250000).
https://www.techonthenet.com/excel/formulas/if_nested.php Page 8 of 9
MS Excel: How to use the Nested IF Functions (WS) 04/03/2020, 7)59 PM
Question: Let's expand the last question further and assume that we need to calculate
percentages based on tiers (not just on the value as whole):
0-125000 =0%
125001-250000 =2%
250001-975000 =5%
975001-1500000 =10%
>1500000 =12%
Say I enter 1,000,000 in B1. The first 125,000 attracts 0%, the next 125,000 to 250,000
attracts 2%, and so on.
Answer: This adds a level of complexity to our formula since we have to calculate each range
of the number using a different percentage.
If the value is between 125,001 and 250,000, it would calculate 0% on the first 125,000 and
2% on the remainder.
If the value is between 250,001 and 250,001, it would calculate 0% on the first 125,000, 2% on
the next 125,000 and 5% on the remainder.
And so on....
Copyright TechOnTheNet.com
https://www.techonthenet.com/excel/formulas/if_nested.php Page 9 of 9