**Please Note: **
This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. If you are using an earlier version (Excel 2003 or earlier), *this tip may not work for you*. For a version of this tip written specifically for earlier versions of Excel, click here: Nesting IF Worksheet Functions.

If you have done any programming, you know that you can create conditional statements known as If...Then statements. Basically, these statements give you a way to say "If this is true, then do that." Excel provides an IF worksheet function to accomplish essentially the same thing in a formula.

You already know how to use the IF function because it was covered in other *ExcelTips. *What you may not know is that you can nest IF functions. For instance, consider the situation where you want to return a value if two other conditions are true. If cell B5 contains a temperature setting and cell B6 contains a pressure setting, you may want cell B7 to contain the words "TOO HIGH" if B5 is greater than 100 and cell B6 is greater than 50. To do something like this, you could use the following formula:

=IF(B5>100,IF(B6>50,"TOO HIGH",""),"")

Notice that there are two IF functions here. The first one checks to see if the value of B5 is greater than 100. If it is, then the next IF function is invoked. This one checks to see if B6 is greater than 50. If it is, then the words "TOO HIGH" are displayed in the cell. If either of the conditional statements fail, then nothing is displayed in the cell.

*ExcelTips* is your source for cost-effective Microsoft Excel training.
This tip (12611) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: **Nesting IF Worksheet Functions**.

**Save Time and Supercharge Excel!** Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out *Excel 2010 VBA and Macros* today!

Indirect references can be very helpful in formulas, but getting your head around how they work can sometimes be ...

Discover MoreWhen working with text in a formula, you may need to extract the left-most characters from a string of text or from a ...

Discover MoreNeed to know which week of the year a particular date falls within? Excel provides the WEEKNUM function so you can easily ...

Discover More**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

2018-05-04 03:41:13

Jens H. Bjørneboe

Michael Schenck: Just found out you don't need the spaces.

Using Win10 and Excel 2016

2018-05-01 03:03:50

Michael (Micky) Avidan

VLOOKUP. HLOOKUP, LOOKUP are al members of the same family.

I wouldn't dare using CHOOSE because the criteria is not always an Integer (CHOOSE needs an Integer as an index_num).

In addition the you cannot select a range for the results - such as: =CHOOSE(E7,F6:F10)

You need to put every result cell separately delimited by a comma.

----------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” Excel MVP – Excel (2009-2018)

ISRAEL

2018-04-30 10:06:17

Rkeev

2018-04-30 05:04:50

Michael (Micky) Avidan

This tip relates to "Excel 2007" and above.

Excel 97/2000/2003 had a limit of 7 nestings vut there were ways to get around that - for example: using VLOOKUP with a small helper table etc..

Excel 2007-2016 has a limit of 64(!)

----------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” Excel MVP – Excel (2009-2018)

ISRAEL

2018-04-29 08:53:33

James McMichael

2018-04-28 07:31:10

Michael Schenck

=IF(B5>100,

___IF(B6>50,

_____"TOO HIGH",

_____IF(B6>45,

_______"MARGINAL",

_______"")),

___IF(B5>90,

_____IF(B6>50,

_______"MARGINAL",

_______""),

_____""))

2018-04-28 07:24:24

Michael Schenck

=IF(B5>100,

IF(B6>50,

"TOO HIGH",

""),

"")

The True and False results are more easily identified.

This is particularly valuable as IF statements become more complex since it makes them easier to debug (obviously the example below could be cleaned up using AND and OR statements):

=IF(B5>100,

IF(B6>50,

"TOO HIGH",

IF(B6>45,

"MARGINAL",

"")),

IF(B5>90,

IF(B6>50,

"MARGINAL",

""),

""))

NOTE: If cell contents are centered or right-justified it throws off thus formula structure. In that case, temporarily left-justify the cell when debugging.

2018-04-28 07:01:40

Ira Bernstein

I'm a long time follower of Excel Tips. Shouldn't today's discussion of nesting IF statements have included the IFS function?

**This site is for you!** If you
use an earlier version of Excel, visit
our *ExcelTips* site focusing on the menu interface.

**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

Copyright © 2021 Sharon Parq Associates, Inc.

## Comments