Multiple IF functions can be nested to allow for multiple criteria. With Excel’s IF function, you can perform a logical comparison between a value and the value you expect, testing for a condition and returning a result if “True” or “False”.

You are watching : what is an if else

The IF function allows a logical comparison between a current value and an expected value. It does this by checking for a condition and returning a result if the value is true or false.

  • IF(a value is true, do this, else do something else)

Therefore, an IF statement can have two results. The first result is returned if the comparison is true, the second if the comparison is false.

IF statements are incredibly robust and form the basis of many spreadsheet models, but they are also at the root of many spreadsheet problems. Ideally, an IF statement should apply to minimal conditions (e.g. Male/Female, Yes/No/Maybe to name a few), but sometimes more complex scenarios need to be evaluated involving the nesting* of more than 3 IF -Functions require.

* “Nesting” is the merging of multiple functions into one formula.

Use the IF function, one of the logical functions, to return one value when a condition is met and a different value when the condition is not met.

Syntax

IF(check;then_value;[else_value])

Example:

  • =IF(A2>B2;”Over budget”;”OK”)

  • =IF(A2=B2;B4-A4;””)

Argument Name

Description

Check

(required)

The condition to check.

then_value

(required)

The value to return if the result of the is TRUE.

else_value

(optional)

The value to return if the result of the is FALSE.

Notes

Although Excel allows nesting of up to 64 different IF functions, this is not advisable. Why?

  • Multiple IF statements require a great deal of concentration to be constructed correctly and to ensure that their logic is properly calculated through each condition to the end. If the formula is not nested 100% correctly, it may only work 75% of the time and return unexpected results 25% of the time. Unfortunately, catching that problematic 25% is almost impossible.

  • Multiple IF statements can be incredibly difficult to manage, especially if you come back to them later and try to figure out what you, or worse, someone else was trying to accomplish.

If you have an IF statement that just seems to keep growing with no end in sight, put your mouse down and reconsider your strategy.

Let’s see how to properly construct a complex nested IF statement with multiple IF functions, and when to use another tool from Excel’s arsenal.

Examples

The following is an example of a fairly standard nested IF statement that converts student test results into the lettered ratings.

See also  11 is very slow and unresponsive - how to fix a slow laptop windows 10

Complex nested IF statement - The formula in E2 is =IF(B2>97;”A+”:IF(B2>93;”A”;IF(B2>89;”A-“;IF( B2>87;”B+”;IF(B2>83;”B”;IF(B2>79;”B-“;IF(B2>77;”C+”;IF(B2>73;”C”;IF (B2>69;”C-“;IF(B2>57;”D+”;IF(B2>53;”D”;IF(B2>49;”D-“;”F”)))))) ))))))’ src=”https://support.content.office.net/de-de/media/298e14c6-9314-4f28-9232-c3b1a1245570.png”/></p>
<ul>
<li>
<p>=IF(D2>89;”A”;IF(D2>79;”B”;IF(D2>69;”C”;IF(D2>59;”D”;”F”))) )</p>
<p>This complex nested IF statement follows simple logic: </p>
</li>
</ul>
<ol type="1">
<li>
<p>If the test result (in cell D2) is greater than 89, the student gets an A.</p>
</li>
<li>
<p>If the test score is higher than 79, the student gets a B.</p>
</li>
<li>
<p>If the test score is higher than 69, the student gets a C.</p>
</li>
<li>
<p>If the test score is greater than 59, the student receives a D.</p>
</li>
<li>
<p>Otherwise, the student gets an F.</p>
</li>
</ol>
<p>This particular example is relatively safe because the correlation between test results and scores is not unlikely to change, so it doesn’t require much maintenance. But here’s a thought – what if you need to segment the notes between A+, A, and A- (and so on)? Now your four CONDITIONS if the IF statement needs to be rewritten to have 12 conditions! Your formula would now look like this:</p>
<ul>
<li>
<p>=IF(B2>97;”A+”;IF(B2>93;”A”;IF(B2>89;”A-“;IF(B2>87;”B+”;IF(B2>83 ;”B”;IF(B2>79;”B-“;IF(B2>77;”C+”;IF(B2>73;”C”;IF(B2>69;”C-“;IF(B2> ;57;”D+”;IF(B2>53;”D”;IF(B2>49;”D-“;”F”))))))))))))</p>
</li>
</ul>
<p>The formula still works correctly and as expected, but it takes more time to write and test to ensure it runs correctly. Another obvious problem is that you would have to enter the scores and the corresponding classifications by hand. How likely are you to accidentally make a typo? Now imagine doing this 64 times under even more complex conditions! Of course it’s possible, but do you really want to go to that length of effort and risk making mistakes that are very difficult to spot?</p>
<p class="ocpAlertSection"><b class="ocpNote">Tip: </b>Every function in Excel requires an opening and closing bracket (). Excel helps you compose the formula by color-coding different parts as you edit. For example, if you are editing the formula above, moving the cursor after each closing bracket “)” causes the corresponding opening bracket to appear in the same color. This can be especially useful with complex nested formulas when trying to figure out if you have enough pairs of parentheses.</p>
<h2>More examples</h2>
<p>The following is a typical example of calculating a sales commission based on sales volume.</p>
<p><img alt="The formula in cell D9 is IF(C9>15000;20%;IF(C9>12500;17.5%;IF(C9>10000;15%;IF(C9>7500;12.5%) ;IF(C9>5000;10%;0)))))” src=”https://support.content.office.net/de-de/media/fb2c2f37-d09d-4f6e-8e8a-82707ba479db.png” /></p>
<ul>
<li>
<p>=IF(C9>15000;20%;IF(C9>12500;17.5%;IF(C9>10000;15%;IF(C9>7500;12.5%;IF(C9>5000; 10%;0)))))</p>
</li>
</ul>
<p>This formula says: IF(C9 is greater than 15,000, returns 20%; IF(C9 is greater than 12,500, returns 17.5%, etc.</p>
<p>While remarkably similar to the grades example earlier, this formula is a good example of how difficult it can be to manage large-scale What-If statements – what do you need to do as your organization adds new compensation levels, and possibly even want to change the existing euro or percentage values? You would have a lot to do!</p>
<p class="ocpAlertSection"><b class="ocpNote">Tip: </b>You can insert line breaks in the formula bar to make long formulas easier to read. Just press ALT+ENTER before the text you want to wrap on a new line.</p>
<div style="clear:both; margin-top:0em; margin-bottom:1em;"><a href="https://mlmdevelopers.com/what-to-watch-on-netflix-catalog-updated-in-march-2022-what-to-watch-on-netflix/" target="_blank" rel="dofollow" class="u0463877b5e0e1e732318afe8c18f9942"><!-- INLINE RELATED POSTS 2/3 //--><style> .u0463877b5e0e1e732318afe8c18f9942 { padding:0px; margin: 0; padding-top:1em!important; padding-bottom:1em!important; width:100%; display: block; font-weight:bold; background-color:inherit; border:0!important; border-left:4px solid inherit!important; text-decoration:none; } .u0463877b5e0e1e732318afe8c18f9942:active, .u0463877b5e0e1e732318afe8c18f9942:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; text-decoration:none; } .u0463877b5e0e1e732318afe8c18f9942 { transition: background-color 250ms; webkit-transition: background-color 250ms; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; } .u0463877b5e0e1e732318afe8c18f9942 .ctaText { font-weight:bold; color:inherit; text-decoration:none; font-size: 16px; } .u0463877b5e0e1e732318afe8c18f9942 .postTitle { color:inherit; text-decoration: underline!important; font-size: 16px; } .u0463877b5e0e1e732318afe8c18f9942:hover .postTitle { text-decoration: underline!important; } </style><div style="padding-left:1em; padding-right:1em;"><span class="ctaText">See also</span>  <span class="postTitle">What to watch on Netflix - catalog updated in March 2022 - what to watch on netflix</span></div></a></div><p>The following is an example of the commission scenario with broken logic:</p>
<p><img alt="The formula in D9 is incorrect and reads =IF(C9>5000;10%;IF(C9>7500;12.5%;IF(C9>10000;15%;IF(C9>12500;17 ,5%;IF(C9>15000;20%;0)))))” src=”https://support.content.office.net/de-de/media/b1eeb416-b9d0-4537-9594-cb54c7f86c59 .png”/></p>
<p>Can you see where the error is? Compare the order of sales with the previous example. What is the order here? As you can see, the order is from lowest to highest (from €5,000 to €15,000) and not the other way around. But why is this such a big deal? The reason is that the formula cannot perform the first evaluation for a value greater than €5,000. For example, if you have sales of $12,500, the IF statement will return 10% because the value is greater than $5,000, and then stop. This can be particularly problematic as in many situations these types of errors go unnoticed until they have a negative impact. So you know that complex nested IF statements can cause serious problems, but what can you do? In most cases, you can use the VLOOKUP function instead of creating a complex formula with the IF function. For the function<span class="ocpArticleLink">VLOOKUP</span> you must first create a related table:</p>
<p><img decoding="async" alt="The formula in cell D2 is =VLOOKUP(C2;C5:D17;2;TRUE)" src="https://support.content.office.net/de-de/media/c75a2b0d-ba95- 41d7-b525-d6a1618d0a59.png"/></p>
<ul>
<li>
<p>=VLOOKUP(C2;C5:D17;2;TRUE) </p>
</li>
</ul>
<p>This formula says to look for the value in C2 in the range C5:C17. If the value is found, the corresponding value from the same row in column D is returned.</p>
<p><img decoding="async" alt="The formula in cell C9 is =VLOOKUP(B9;B2:C6;2;TRUE)" src="https://support.content.office.net/de-de/media/512793b1-2b95- 4bb4-bb7d-b8ae3d904ecc.png"/></p>
<ul>
<li>
<p>=VLOOKUP(B9;B2:C6;2;TRUE)</p>
</li>
</ul>
<p>This formula searches for the value in cell B9 in the range B2:B22. If the value is found, the corresponding value from the same row in column C is returned.</p>
<p class="ocpAlertSection"><b class="ocpNote">Note: </b>Both VLOOKUPS use the TRUE argument at the end of the formulas, i.e. that is, they should look for an approximate match. In other words, it will match the exact values ​​in the lookup table and all values ​​in between. In this case, the lookup tables must be sorted in ascending order from smallest to largest.</p>
<p>VLOOKUP is covered in detail here <span class="ocpArticleLink">,</span>but this is certainly a lot simpler than a complex 12-level nested IF statement! There are also other, less obvious benefits:</p>
<ul>
<li>
<p>VLOOKUP related tables are readily available and easy to view.</p>
</li>
<li>
<p>Table values ​​can be easily updated and you don’t need to edit the formula when conditions change.</p>
</li>
<li>
<p>If you don’t want other people to be able to see or change the related table, just save it to another worksheet.</p>
</li>
</ul>
<h2>Did you know?</h2>
<p>There is now an <span class="ocpArticleLink">IFS function</span> that can replace multiple nested IF statements with a single function. The initial scores example, using four nested IF functions:</p>
<ul>
<li>
<p>=IF(D2>89;”A”;IF(D2>79;”B”;IF(D2>69;”C”;IF(D2>59;”D”;”F”))) )</p>
</li>
</ul>
<p>can be greatly simplified by a single IFS function:</p>
<ul>
<li>
<p>=IFS(D2>89;”A”;D2>79;”B”;D2>69;”C”;D2>59;”D”;TRUE;”F”)</p>
</li>
</ul>
<div style="clear:both; margin-top:0em; margin-bottom:1em;"><a href="https://mlmdevelopers.com/rotate-the-screen-turn-the-display-upside-down-this-is-how-it-works-turn-a-screen-upside-down/" target="_blank" rel="dofollow" class="u43f5529967ecd6b7867ecd7d92afaf40"><!-- INLINE RELATED POSTS 3/3 //--><style> .u43f5529967ecd6b7867ecd7d92afaf40 { padding:0px; margin: 0; padding-top:1em!important; padding-bottom:1em!important; width:100%; display: block; font-weight:bold; background-color:inherit; border:0!important; border-left:4px solid inherit!important; text-decoration:none; } .u43f5529967ecd6b7867ecd7d92afaf40:active, .u43f5529967ecd6b7867ecd7d92afaf40:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; text-decoration:none; } .u43f5529967ecd6b7867ecd7d92afaf40 { transition: background-color 250ms; webkit-transition: background-color 250ms; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; } .u43f5529967ecd6b7867ecd7d92afaf40 .ctaText { font-weight:bold; color:inherit; text-decoration:none; font-size: 16px; } .u43f5529967ecd6b7867ecd7d92afaf40 .postTitle { color:inherit; text-decoration: underline!important; font-size: 16px; } .u43f5529967ecd6b7867ecd7d92afaf40:hover .postTitle { text-decoration: underline!important; } </style><div style="padding-left:1em; padding-right:1em;"><span class="ctaText">See also</span>  <span class="postTitle">Rotate the screen, turn the display upside down - this is how it works. - turn a screen upside down</span></div></a></div><p>The benefit of the IFS function is that you don’t have to worry about all those IF statements and parentheses.</p>
<h2>Need more help?</h2>
<p>You can always ask an expert in the <span class="ocpExternalLink" target="_blank">Excel Tech Community</span> or get support in the <span class="ocpExternalLink" target="_blank">Answers Community </span> received.</p>
</p>
</div>
<p></br></p>
<h2><span class="ez-toc-section" id=""></span><span style="color: #ff0000;"><strong>See more information related to the topic what is an if else</strong></span><span class="ez-toc-section-end"></span></h2>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>15 IF Statement Examples in Excel – Simple to Advanced – Workbook Included<span class="ez-toc-section-end"></span></h3>
<p><div class="fluid-width-video-wrapper" style="padding-top: 56.2183%;"><iframe src="https://www.youtube.com/embed/I7p6Hzap4qo"></iframe></div>
</p>
<p style="display:none"><img decoding="async"  src="https://i.ytimg.com/vi/I7p6Hzap4qo/maxresdefault.jpg" alt="alt"></p>
<ul id="ul_content">
<li><strong>Author</strong>: TeachExcel</li>
<li><strong>Post date</strong>: 2018-02-21</li>
<li><strong>Ratings</strong>: 4 ⭐ ( 2859 Ratings )</li>
<li><strong>Match search results</strong>: VBA/Macros Course (40% Discount): https://www.teachexcel.com/vba-course-update.php?src=youtube_v_description_I7p6Hzap4qo
<p>Excel Forum: https://www.teachexcel.com/talk/microsoft-office?src=yt</p>
<p>Excel File: https://www.teachexcel.com/excel-tutorial/2038/15-if-statement-examples-in-excel?nav=yt</p>
<p>15 different examples of using the IF statement function in Microsoft Excel.</p>
<p>This includes examples that range from simple to complex and includes many different scenarios that will show you the ways that you can use the IF statement to make your spreadsheets better and more advanced.</p>
<p>You will learn how to use comparison operators, text, numbers, other functions and even other IF statements within IF statements.</p>
<p>This tutorial does include Excel files so that you can work along with it – click the link at the top of the description to download it.</li>
</ul>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>C++ If…else (With Examples)<span class="ez-toc-section-end"></span></h3>
<ul id="ul_content">
<li><strong>Author</strong>: www.programiz.com</li>
<li><strong>Ratings</strong>: 5 ⭐ ( 4657 Ratings )</li>
<li><strong>Match search results</strong>: In this tutorial, we will learn about the C++ if…else statement and its use in decision making programs with the help of examples. The if…else statement is used to run one block of code under certain conditions and another block of code under different conditions.</li>
</ul>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>Excel formula: If else<span class="ez-toc-section-end"></span></h3>
<ul id="ul_content">
<li><strong>Author</strong>: exceljet.net</li>
<li><strong>Ratings</strong>: 3 ⭐ ( 9539 Ratings )</li>
<li><strong>Match search results</strong>: If you need to test a condition, then take one action if the condition is TRUE, and another action if the condition if FALSE, you can use the IF function. The IF function has the concept of “else” built-in.</li>
</ul>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>What are if else statements in programming? How do I use them? Why should I care?<span class="ez-toc-section-end"></span></h3>
<ul id="ul_content">
<li><strong>Author</strong>: kalletech.com</li>
<li><strong>Ratings</strong>: 4 ⭐ ( 4188 Ratings )</li>
<li><strong>Match search results</strong>: </li>
</ul>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>What is If Else?<span class="ez-toc-section-end"></span></h3>
<ul id="ul_content">
<li><strong>Author</strong>: www.computerhope.com</li>
<li><strong>Ratings</strong>: 3 ⭐ ( 6114 Ratings )</li>
<li><strong>Match search results</strong>: Computer dictionary definition for what if else means including related links, information, and terms.</li>
</ul>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>JavaScript if else else if<span class="ez-toc-section-end"></span></h3>
<ul id="ul_content">
<li><strong>Author</strong>: www.w3schools.com</li>
<li><strong>Ratings</strong>: 3 ⭐ ( 1621 Ratings )</li>
<li><strong>Match search results</strong>: </li>
</ul>
<h3 class="title style-scope ytd-video-primary-info-renderer"><span class="ez-toc-section" id=""></span>C Conditional Statement: IF, IF Else and Nested IF Else with Example<span class="ez-toc-section-end"></span></h3>
<ul id="ul_content">
<li><strong>Author</strong>: www.guru99.com</li>
<li><strong>Ratings</strong>: 4 ⭐ ( 8500 Ratings )</li>
<li><strong>Match search results</strong>: What is a Conditional Statement? In a ‘C’ program are executed sequentially. This happens when there is no condition around the statements. If you put some condition for a block of statements the flow</li>
</ul>
<p>See more articles in this category: <a href="https://mlmdevelopers.com/computer-tips/">Computer tips</a></p>
                                                     <script>
    function pinIt()
    {
      var e = document.createElement(