Nested IF Function - How to apply it in your Excel Worksheet

Excel is far more than a mere spreadsheet application that allows you to store and manipulate columns of data. When Microsoft launched their applications, they included the power of visual basic for applications, known as VBA, which allows a user access to a powerful set of visual basic programming commands within their office applications. The if statement within excel is an excellent example of how the power of VBA can transform a spreadsheet into a powerful application.

This tutorial will show you how the if statement functions as was as to how to nest if statements to create powerful calculations within your Excel spreadsheet. This tutorial assumes that you have a solid foundation in using Excel spreadsheets. It assumes that you know how to create a spreadsheet, how to add columns of data. It also assumes you have a basic understanding of how to manipulate the data within an Excel spreadsheet. If you want to get the solid foundation you need to follow this tutorial then Excel Courses available on our website will teach all you need to know.

Before we begin a practical example of the nested if statement in excel, you need to know how the if statement works, to begin with.

How the if the function works

As per the heading, we’ll refer to this as NESTED IF from here onwards. In brief summary, the Excel NESTED IF function performs a user instructed logical test, if that test is TRUE, it performs an action, if it's FALSE, it does another action.  Learning how to nest IFs will open up your spreadsheet to an advanced level and rally expand your horizons!

Syntax of this function explained


This is one of the most useful in Excel.  When harnessed and nested (using multiple IF functions in one), you can have one very powerful multi levelled formula in ONE cell that performs an astonishing number of logical tests.


As per Excel, it defines this part of the syntax as “any value or expression that can be evaluated to TRUE or FALSE.”.  This is where you make your test of a cell, see below under Examples for more detail.


As per Excel, it defines this as “the value that’s returned if Logical_test is TRUE, if omitted, TRUE is returned.  You can nest up to seven IF functions”

There is a limit of 7 nested functions, but only up to Excel 2007.  Since then, it’s been increased to 64 IF statements in ONE formula.  I’ve yet to get there!  If you start getting into 15 levels and above you might want to revisit your methods in how you create the logical tests.


As per Excel, it defines this as “the value that’s returned if Logical_test is FALSE, if omitted, FALSE is returned.

It’s here where NESTING typically begins and we’ll make this clear by looking at a simple example and visualizing how the process tree works when following it through.

The IF function is a function that allows you to compare a value and then to manipulate that value depending on the value. The easiest way to understand the IF function is to compare the function to a real-life if statement. If it rains we’re ordering in but if the weather is good we’ll go out. The if function in programming works exactly the same way as our real-life statement. The program evaluates the condition – is it raining – and depending on whether the answer is true or false, the if function then performs a set of instructions.

A Nested IF statement is simply an if statement that is declared within another if statement. Using our raining example – let’s add another if by saying that if we are going out then if it’s the afternoon we’ll go for a picnic but if it's an evening we’ll go for pizza. Excel evaluates the statement in exactly the same as we would. It would first check if it’s raining. It would then move onto the next if statement and check whether it’s afternoon or evening. The most important thing about using an if statement in excel is to ensure that the program logic is indeed logical.

So let us create an example in excel which we can use to demonstrate how the nested if statement works.

Read More

Repairing Damaged Excel Workbooks

There is never a good time to encounter the prompt that informs you that the workbook you’ve opened is damaged and cannot be opened. When this happens, the first thing to do is stop and take a breath. All may not be lost with your file. In this article I’ll lay out a couple things to try before you give up. Y If you see this prompt, the first thing to do is to press Enter to accept the default choice of Repair, or else click Repair with your mouse. This often clears up many issues with Excel workbooks. In fact, I often use this process on files that are not necessarily outright corrupted, but feel like something isn’t right:

  1. Within Excel’s Open dialog box click on the workbook that you wish to repair.
  2. Click the arrow at the right of the Open button. 
  3. Choose Open and Repair from the menu that appears.
  4. Click Repair from the prompt. 
Read More

Commonly Used Data Analysis Functions in Excel

On the off chance that you've ever utilized Excel, at that point you've presumably encountered the distress of picking an erroneous formula to dissect a data set. Perhaps you chipped away at it for quite a long time, at last surrendering in light of the fact that the data yield wasn't right or, the function was excessively muddled, and it appeared to be easier to tally the data yourself physically. In the event that that seems like you, at that point this Data Analysis in Excel top 15 is for you. 

There are many functions in Excel, and it tends to be overpowering attempting to coordinate the correct formula with the correct sort of data analysis. The most helpful functions don't need to be muddled. Fifteen straightforward functions will improve your capacity to dissect data, making you can't help thinking about how you ever lived without them. 

Regardless of whether you fiddle with Excel or use it vigorously at your specific employment, there is a function for everybody in this rundown.


 =CONCATENATE is one of the easiest to learn but most powerful formulas when conducting data analysis. Combine text, numbers, dates and more from multiple cells into one. This is an excellent function for creating API endpoints, product SKUs, and Java queries.





 =LEN quickly provides the number of characters in a given cell. As in the example above, you can identify two different kinds of product Stock Keeping Units (SKUs) using the =LEN formula to see how many characters the cell contains. LEN is especially useful when trying to determine the differences between different Unique Identifiers (UIDs), which are often lengthy and not in the right order.





=COUNTA identifies whether a cell is empty or not. In the life of a data analyst, you’re going to run into incomplete data sets daily. COUNTA will allow you to evaluate any gaps the dataset might have without having to reorganize the data.





 =DAYS is exactly what it implies. This function determines the number of calendar days between two dates. This is a useful tool for assessing the lifecycle of products, contracts, and run rating revenue depending on service length – a data analysis essential.

 =NETWORKDAYS is slightly more robust and useful. This formula determines the number of “workdays” between two dates as well as an option to account for holidays. Even workaholics need a break now and then! Using these two formulas to compare time frames is especially helpful for project management.




note: [numberofholidays] is optional







 =SUMIFS is one of the “must-know” formulas for a data analyst. The common formula used is =SUM, but what if you need to sum values based on multiple criteria? SUMIFS is it. In the example below, SUMIFS is used to determine how much each product is contributing to top-line revenue.

 Formula: =SUMIF(RANGE,CRITERIA,[sum_range])

note: [sum_range] is optional




 Much like SUMIFS, AVERAGEIFS allows you to take an average based on one or more criteria.


note: [average_range] is optional




VLOOKUP is one of the most useful and recognizable data analysis functions. As an Excel user, you’ll probably need to “marry” data together at some point. For example, accounts receivable might know how much each product costs, but the shipping department can only provide units shipped. This is the perfect use case for VLOOKUP.

 In this example below we use reference data (A2) combined with the pricing table to have excel looking up matching criteria in the first column and returning an adjacent value.





=FIND/=SEARCH are powerful functions for isolating specific text within a data set. Both are listed here because =FIND will return a case-sensitive match, i.e. if you use FIND to query for “Big” you will only return Big=true results. But a =SEARCH for “Big” will match with Big or big, making the query a bit broader. This is particularly useful for looking for anomalies or unique identifiers.


note: [start_number] is optional and is used to indicate the starting cell in the text to search

=(FIND(“Big”, A2,1)””)



 =IFERROR is something that any analyst who actively presents data should take advantage of. Using the previous example, looking for specific text/values in a dataset won’t return a match. This causes a #VALUE error, and while harmless, it is distracting and an eyesore.

 Use =IFERROR to replace the #VALUE errors with any text/value. In the example above, the cell is blank so that data consumers can easily pick out which rows returned a matching value.





=COUNTIFS is the easiest way to count the number of instances a dataset meets a set of criteria. In the example above the product name is used to determine which product was the best seller. COUNTIFS is powerful because of the limitless criteria you can input.





=LEFT, =RIGHT are efficient and straightforward methods for extracting static data out of cells. =LEFT will return the “x” number of characters from the beginning of the cell, while =right will return the “x” number of characters from the end of the cell. In the example below, =LEFT is used to extract the consumer’s area code from their phone number, while =RIGHT is used to extract the last four digits.


=LEFT(A6, 3)






 =RANK is an ancient excel function, but that doesn’t downplay its effectiveness for data analysis. =RANK allows you to quickly denote how values rank in a dataset in ascending or descending order. In the example, RANK is being used to determine which clients order the most product.


note: [order] is optional


note: 0 returns the largest value ranked #1



=MINIFS is very similar to the min function except it allows you to take the minimum of a set of values, and match on criteria as well. In the example, =MINIFS is used to find the lowest price each product sold for.





 =MAXIFS, like its counterpart minifs, allows you to match on criteria, but this time it looks for the maximum number.





 =SUMPRODUCT is an excellent function to calculate average returns, price points, and margins. SUMPRODUCT multiples one range of values by its corresponding row counterparts. It’s data analysis gold. In the example below, we calculate the average selling price of all our products by using sumproduct to times Price by Quantity and then divide by the total volume sold.




We hope you found that useful. If you’re interested in Data Analysis in Excel, take a look at the Excel course that has helped hundreds of thousands of people master Excel.

Read More

Clearing Numeric Inputs from an Excel Spreadsheets

Erasing manual inputs from a spreadsheet that you want to reuse can be a tedious task. Despite our best intentions, entries often get saved into our master copies of spreadsheets that we reuse. Fortunately, you don’t have to go cell by cell to erase inputs. Specifically, we’re going to look at erasing numeric inputs, although you may be able to alter the technique to replace text-based inputs:

  1. Select the cells that contain the data you want to remove, which can include numeric inputs, text, and formulas. To select an entire worksheet, click the top left corner of the worksheet frame, otherwise manually select two or more cells.
  2. Activate Excel’s Home menu.
  3. Choose Find & Select.
  4. Choose Go To Special.
  5. Choose Constants.
  6. Clear the checkboxes for Text, Logical, and Errors, leaving only Numbers selected.
  7. Click OK. Press the Delete key to clear the cells but keep the formatting intact.
  8. If you wish to completely clear the cells, choose Clear and then Clear All on the Home menu instead.

Read More

Connect with Us

Copyright © 2021 Excel Accountant. All Rights Reserved.