We may be compensated for your purchase of any of the products featured on this page – it helps us keep the lights on :)
You’ve probably heard someone talk about a nested formula in Excel and wondered what on earth is a nested formula??? After all, there’s no nest button or nest function.
Turns out, you’ve probably been using nested formulas all along!
So, what exactly is a Nested Formula in Excel?
Click to Watch: What is a Nested Formula in Excel – Tutorial
A nested formula is one that uses another function in its calculations. In other words, it refers to combining formulas.
For example, a formula like =SUM(MAX(A1:A3), MAX(B1:B3)) would be a nested function.
In this example, the MAX functions are “nested” inside the SUM function.
Fixing Errors in Excel Nested Formulas
Nested formulas can get complex as you combine more and more functions and calculations.
This can cause problems if your nested formula has an error you need to fix.
Here are some tips that can help you audit and fix nested formulas.
Use the Color Coded Parentheses Around Formulas as a Guide
Most of the time, the formula error is a result of a missing or misplaced parenthesis.
You might have noticed when you step into a formula (either by going to the Formula Bar or by pressing F2 on your keyboard), the formula becomes very colorful.
These colors serve a purpose. Excel provides colors to help when auditing formulas.
When it comes to parentheses, there are a couple of important things to remember:
- The main function in your nested formula will always start and end with black parentheses. This means that, once you’ve finished writing your nested formula, the opening and closing parentheses will both be black. If they are not, there’s an error.
- For the other calculations in your nested formula, the opening and closing parentheses for each will always be the same color.
Let’s look at an example of this (purposely complicated) nested IF function:
*FYI, the number of each step in the image above corresponds with the number in the list below*
- The first and last parentheses of the IF function, which is the main function, are both black.
- The range of cells for the first AVERAGE function, B2:C2, is surrounded by matching red parentheses.
- The next part of the function averages the highest values for 2 data ranges and multiplies their result by 0.85. This full calculation is encased in red parentheses.
- The AVERAGE function, which is averaging the result of the 2 MAX functions, is surrounded by purple parentheses.
- And each MAX function nested inside the AVERAGE function is surrounded by green parentheses.
Using Named Ranges in Nested Formulas
Another tactic you can use to help you quickly find (and avoid!) errors in your nested formulas is to reference named ranges.
Why? Let’s face it, looking at a bunch of numbers can get confusing.
Plus, if you copy your formula to other cells that reference the same data range, you have to also worry about whether you’re referencing the right cells or not.
Using named ranges in your nested formulas can be a big help.
Consider the nested IF formula from our earlier example:
Compared to the same formula, but with named ranges for the cell references:
Using named ranges makes it much easier to read!
FYI, this was created using the desktop version of Excel in Microsoft 365.
Leave a Reply