Chapter 11: Data Analysis and Formula Troubleshooting
Learning Objectives
- Combine data from several ranges or worksheets with Consolidate.
- Find the input that produces a target result with Goal Seek.
- Create, show and summarize scenarios with Scenario Manager.
- Trace precedents and dependents, and monitor cells with the Watch Window.
- Find and fix formula errors with error checking and Evaluate Formula.
This chapter covers two groups of MO-211 skills. The first group analyzes data: Consolidate combines several ranges into one summary, and Goal Seek and Scenario Manager answer "what if?" questions. The second group troubleshoots formulas: tools that show how formulas connect, watch values change, and step through a calculation to find what went wrong.
11.1 Consolidate
Consolidate combines data from several ranges into one summary range. The ranges can be on different sheets or in different workbooks. A typical use is a workbook with one sheet per region or month, all laid out alike, and a summary sheet that totals them.
11.1.1 Two ways to match the data
- By position. Every source range has the same layout: the same items in the same rows and columns. Excel combines the first cell of each, the second cell of each, and so on.
- By category. The source ranges have labels, but the items may be in a different order or some may be missing. Excel matches rows and columns by their labels.
11.1.2 Consolidating data
- On the summary sheet, click the cell where the result should start (the top-left cell).
- Choose Data › Consolidate.
- Choose the Function: Sum, Count, Average, Max, Min, Product and others.
- Click in Reference, go to the first source sheet, select the range and click Add. Repeat for each source range. Each one appears under All references.
- For consolidation by category, include the labels in each range and check Use labels in Top row, Left column or both. For consolidation by position, leave them unchecked and select only the numbers.
- Optionally, check Create links to source data (see below).
- Click OK.
11.1.3 Static or linked
Without Create links to source data, the result is plain numbers that don't change when the source data changes. To update them, open Data › Consolidate again (it remembers the references) and click OK.
With Create links to source data, Excel inserts hidden rows with formulas that link to each source cell, and outlines the result so each total can be expanded to show its parts. The result updates when the source changes. This option isn't available when the source and the summary are on the same worksheet.
Read the task for the function and the labels. "Summarize the average monthly sales from the North, South and West worksheets, using the row and column labels" means Function: Average, three references that include the labels, and both Use labels in boxes checked.
11.2 Goal Seek
Goal Seek works backward. You know the result you want from a formula, and Goal Seek finds the input value that produces it.
For example, a loan payment formula in B5 uses the loan amount in B1, the rate in B2 and the term in B3. You can afford a payment of $450. What's the largest loan you can take?
- Choose Data › What-If Analysis › Goal Seek.
- Set cell: the formula cell whose result you want to set (B5).
- To value: the result you want (-450, because PMT returns a negative payment).
- By changing cell: the input cell Goal Seek may change (B1). It must hold a value, not a formula.
- Click OK. Goal Seek tries values until the formula hits the target, then shows the Goal Seek Status.
- Click OK to keep the new value in the changing cell, or Cancel to put the original back.
Goal Seek changes the input cell's value for real when you click OK. Read whether the task wants you to keep the result. Also check the sign of the target: Excel's financial functions return payments as negative numbers, so a target payment of $450 is -450.
11.3 Scenario Manager
Goal Seek finds one input. Scenario Manager stores whole sets of input values, called scenarios, so you can switch between them and compare their results. For a budget, you might keep Best case, Expected and Worst case scenarios, each with its own sales growth, costs and staffing.
11.3.1 Adding scenarios
- Choose Data › What-If Analysis › Scenario Manager, then click Add.
- Type a Scenario name.
- In Changing cells, select the input cells the scenario sets. Separate several ranges with commas, or select them with Ctrl. A scenario can change up to 32 cells.
- Add an optional Comment. Under Protection, Prevent changes stops edits to the scenario when the sheet is protected.
- Click OK. In Scenario Values, type a value for each changing cell and click OK.
- Repeat for each scenario.
Create a scenario for the current values first, such as Original or Expected. Once you show another scenario, the original values are replaced, and having a scenario for them lets you switch back.
11.3.2 Showing, editing and deleting scenarios
In the Scenario Manager:
- Show puts the selected scenario's values into the changing cells, so the worksheet's formulas show its results.
- Edit changes a scenario's name, changing cells or values.
- Delete removes a scenario.
- Merge copies scenarios from another sheet or workbook.
11.3.3 Scenario summaries
Summary builds a report comparing every scenario:
- Click Summary.
- Choose Scenario summary (a formatted report) or Scenario PivotTable report.
- In Result cells, select the formula cells to compare, such as net income and cash on hand.
- Click OK.
Excel creates a new sheet, Scenario Summary, with the changing cells and result cells for the current values and for each scenario. The summary doesn't update if the scenarios change later. Make a new one instead.
The summary labels each row with a cell address, like $C$4, unless the cell has a name. Naming the changing and result cells first (chapter 4) makes the summary much easier to read: GrowthRate and NetIncome instead of $C$4 and $C$18.
11.4 Tracing precedents and dependents
The Formula Auditing group on the Formulas tab draws arrows between cells to show how formulas connect.
- A cell's precedents are the cells its formula uses. If C10 contains
=C8*C9, then C8 and C9 are precedents of C10. - A cell's dependents are the cells whose formulas use it. C10 is a dependent of C8 and C9.
11.4.1 Drawing arrows
Select a cell and choose:
- Trace Precedents to draw arrows from its precedents to the cell.
- Trace Dependents to draw arrows from the cell to its dependents.
Click the command again to go one more level back (precedents of the precedents) or forward. The arrows mean different things:
| Arrow | Meaning |
|---|---|
| Blue arrow | A normal connection. A blue box around a range means the formula uses the whole range. |
| Red arrow | The connection leads to or from a cell with an error. |
| Black dashed arrow with a sheet icon | The connection goes to another worksheet or workbook. Double-click the arrow to see the list and go there. |
Double-click any arrow to jump to the cell at its other end.
11.4.2 Removing arrows
Remove Arrows clears all arrows. Its arrow menu has Remove Precedent Arrows and Remove Dependent Arrows, which remove one level at a time. Arrows also disappear when you edit the worksheet or save the file.
Ctrl+[** selects a formula's direct precedents, and **Ctrl+] selects the cell's direct dependents. These are handy for checking what a formula uses when the arrows would be cluttered.
11.5 The Watch Window
The Watch Window shows the values of chosen cells, wherever they are, while you work somewhere else. Use it to see how a change on one sheet affects a total on another, without switching back and forth.
- Choose Formulas › Watch Window.
- Click Add Watch, select the cell or cells to watch, and click Add.
Each watched cell gets a row showing its Book, Sheet, Name (if it has one), Cell, current Value and Formula. The window stays open as you move around the workbook, and you can dock it at the edge of the screen.
- Double-click a row to go to that cell.
- Select a row and click Delete Watch to remove it.
Watches belong to the workbook. They're saved with it and are there the next time you open the Watch Window.
11.6 Error checking and Evaluate Formula
11.6.1 Error values
When a formula can't calculate, it shows an error value. Knowing what each one means is the first step to fixing it:
| Error | Usual cause |
|---|---|
#DIV/0! |
Dividing by zero or by an empty cell |
#N/A |
A lookup function couldn't find the value |
#NAME? |
A misspelled function or range name, or text without quotation marks |
#REF! |
A reference to a cell that was deleted |
#VALUE! |
The wrong kind of data, such as text where a number is needed |
#NUM! |
An impossible number, or a calculation that can't find an answer |
#NULL! |
A space between two ranges that don't overlap, often a missing comma |
#SPILL! |
A dynamic array result is blocked by other data |
#CALC! |
A calculation problem in a dynamic array function, such as FILTER with no matches |
###### |
Not an error: the column is too narrow for the number or date |
11.6.2 Error checking
Excel checks formulas in the background as you work. When a formula breaks one of its rules, a small green triangle appears in the cell's top-left corner. Select the cell to see a warning button. Its menu explains the problem and offers fixes, such as Copy Formula from Above, Update Formula to Include Cells, Convert to Number or Ignore Error.
To step through every flagged cell, choose Formulas › Error Checking. The dialog box shows each problem with buttons to Show Calculation Steps (Evaluate Formula), Ignore Error, Edit in Formula Bar and go to the Previous or Next one. Formulas › Error Checking › Trace Error draws arrows to the cells that cause an error value.
11.6.3 Error checking rules
File › Options › Formulas controls error checking. Enable background error checking turns the green triangles on or off, and Indicate errors using this color changes their color. Reset Ignored Errors brings back warnings you ignored.
The Error checking rules list decides what Excel flags. Each rule can be turned on or off:
- Cells containing formulas that result in an error
- Inconsistent calculated column formula in tables
- Cells containing years represented as 2 digits
- Numbers formatted as text or preceded by an apostrophe
- Formulas inconsistent with other formulas in the region
- Formulas which omit cells in a region
- Unlocked cells containing formulas
- Formulas referring to empty cells
- Data entered in a table is invalid
- Misleading number formats
"Configure Excel to flag formulas that refer to empty cells" means checking that rule in File › Options › Formulas. It's off by default. "Stop Excel from marking numbers stored as text" means unchecking Numbers formatted as text or preceded by an apostrophe.
11.6.4 Evaluate Formula
Evaluate Formula calculates a formula one step at a time, so you can see exactly where it goes wrong. Select the cell and choose Formulas › Evaluate Formula.
The dialog box shows the formula with the next part to be calculated underlined:
- Evaluate calculates the underlined part and shows its result in italics. Click it repeatedly to work through the formula.
- Step In shows the formula in the underlined cell, if that cell itself has a formula. Step Out returns to the original.
- Restart starts over from the beginning.
For example, if =IF(AVERAGE(B2:B9)>D1, "Over", "Under") returns the wrong answer, Evaluate shows the average, then the comparison as TRUE or FALSE, so you can see whether the problem is in the average or in D1.
11.7 Practice
Simmy assessment goes here. Exam-style tasks on Consolidate, Goal Seek, Scenario Manager, tracing precedents and dependents, the Watch Window, error checking and Evaluate Formula. When a student misses a task, Simmy builds the AI prompt (the task as worded, what the student did, and the correct result).
Starting data. A workbook named Willow Creek Events with sheets Spring, Summer, Fall, Summary, Planner and Loan.
Spring, Summer, Fall (A1:D6 each): row 1 headings Event Type, Bookings, Revenue, Costs; rows 2–6 list Weddings, Corporate, Birthdays, Reunions, Concerts, in a different order on each sheet, with different values. Example (Spring): Weddings 12 / 186,000 / 121,000; Corporate 9 / 64,500 / 38,200; Birthdays 21 / 31,500 / 17,900; Reunions 4 / 14,800 / 8,600; Concerts 3 / 42,000 / 29,500.
Summary: empty.
Planner (A1:C14). Inputs: B3 Guests (120), B4 Price per guest (85), B5 Food cost per guest (38), B6 Staff count (8), B7 Staff cost each (240), B8 Venue fee (2,500). Results: B10 Revenue =B3*B4; B11 Costs =B3*B5+B6*B7+B8; B12 Profit =B10-B11; B13 Margin =B12/B10. Cell B14 holds =B12/B15 (B15 is empty), which shows #DIV/0!.
Loan: B1 Loan amount 250,000; B2 Annual rate 0.065; B3 Years 15; B5 Monthly payment =PMT(B2/12,B3*12,-B1).
Tasks.
- On the Summary worksheet, starting at cell A1, create a summary that totals the bookings, revenue and costs for each event type from the Spring, Summer and Fall worksheets. Use the labels in the top row and left column of each range. Expected result: Consolidate, Function Sum, references Spring!$ADADAD$6, Top row and Left column checked; five event types with totals. Objective: Summarize data from multiple ranges by using the Consolidate feature.
- On the Loan worksheet, find the loan amount that results in a monthly payment of exactly 1,800. Keep the result. Expected result: Goal Seek with Set cell B5, To value 1800, By changing B1; B1 ≈ 206,634. Objective: Perform what-if analysis by using Goal Seek.
- On the Planner worksheet, create a scenario named Current that uses the current values in B3 and B4. Then create a scenario named Large Event that sets the guests to 250 and the price per guest to 72. Expected result: two scenarios, Current (120, 85) and Large Event (250, 72), with changing cells B3:B4. Objective: Perform what-if analysis by using Scenario Manager.
- Create a scenario summary report that shows the profit and margin results for both scenarios. Expected result: a Scenario Summary sheet with result cells B12 and B13. Objective: Perform what-if analysis by using Scenario Manager.
- On the Planner worksheet, display arrows that show which cells the formula in B12 uses, including the cells used by those cells. Expected result: precedent arrows traced two levels from B12 (to B10, B11, and their inputs B3:B8). Objective: Trace precedence and dependence.
- Add cells B12 and B13 of the Planner worksheet to a window that monitors their values while you work on other worksheets. Expected result: Watch Window contains Planner!B12 and Planner!B13. Objective: Monitor cells and formulas by using the Watch Window.
- Configure Excel to flag formulas that refer to empty cells. Expected result: error checking rule "Formulas referring to empty cells" enabled. Objective: Validate formulas by using error checking rules.
- Fix the error in cell B14 of the Planner worksheet so it calculates profit per guest. Do not change any other cell. Expected result: B14
=B12/B3(the error came from dividing by empty B15). Objective: Evaluate formulas; Validate formulas by using error checking rules.