Excel Formula Evaluator: Debug & Trace
In this article
Yes, you can see exactly how a formula in Excel calculates its result step-by-step. This is called the Formula Evaluator. You do not need any extra software or add-ins; it is a built-in tool. To use it, open the Formulas tab on the ribbon and click the Evaluate Formula button. Select the cell you want to check, and the tool will walk you through the calculation, showing the intermediate values and highlighting the part of the formula being calculated at any moment. This is the fastest way to find errors or understand complex logic without rewriting your spreadsheet.
What You'll Need
- A computer with Microsoft Excel installed. The steps below are for the Windows version of Excel, but the Formula Evaluator is also available on the Mac version.
- A spreadsheet (an .xlsx or .xls file) containing at least one formula you want to check.
- A basic understanding of the formula you are testing. It helps to know roughly what the result should be.
Step-by-Step
- Open your spreadsheet. Launch Excel and open the workbook that contains the formula you want to debug. Ensure the sheet with the problematic or complex formula is the active one.
- Select the cell with the formula. Click on the cell that contains the formula you want to trace. The formula itself will be displayed in the formula bar above the grid. Do not click inside the formula bar yet; you want to evaluate the result of the cell as a whole first.
- Open the Formulas tab. Look at the top of the Excel window. Click on the "Formulas" tab in the ribbon. This tab contains all the tools for working with formulas, including auditing, dependencies, and evaluation.
- Find the Evaluate Formula button. In the "Formula Auditing" section of the ribbon, look for the button labeled "Evaluate Formula." It usually has an icon that looks like a small magnifying glass over a sheet of paper with an equals sign.
- Select the cell. Click the "Evaluate Formula" button. A dialog box will appear. In the box labeled "Reference," the address of the cell you clicked in step 2 should already be selected. Click the "OK" button or press Enter to start the evaluation.
- Follow the evaluation steps. The dialog box will now show your formula, but with the first part of it underlined. The box below it, labeled "Evaluation," will show what that first part evaluates to. For example, if your formula starts with
=SUM(A1:A5), the first part underlined will beSUM(A1:A5)and the evaluation box will show the result of that sum. - Click "Evaluate" repeatedly. Click the "Evaluate" button again. Now, the next part of the formula will be underlined. The evaluation box will show the result of that next step. For a
SUMfunction, Excel will then show the individual numbers from the range A1 through A5, and finally, the total sum. This allows you to see exactly how Excel is processing the data. - Use "Step In" for nested functions. If your formula contains a nested function (a function inside another function), the evaluation process can get confusing. If you see a nested function underlined, click the "Step In" button instead of "Evaluate." This will open a new evaluation box showing the inner function. You can then evaluate that inner function completely. To go back to the main formula, click "Step Out." This is very useful for debugging complex formulas like
=IF(OR(ISBLANK(D2),ISBLANK(E2)),0,VLOOKUP(D2,Table1,2,FALSE)). - Check the "Watch Window" if needed. If your formula depends on cells in a different part of the sheet that are not visible on your screen, you can use the "Watch Window." This is also found on the Formulas tab. Click "Watch Window,” then click "Add Watch.” Select your formula cell. A new window will appear showing the cell, its current value, its formula, and the worksheet and range it is on. You can then scroll around your spreadsheet while the Watch Window shows you how the value changes.
Common Mistakes
One of the most common mistakes is trying to evaluate a formula that contains a circular reference. A circular reference occurs when a formula refers to itself, either directly or through a chain of other formulas. If you try to evaluate a circular reference, Excel will display an error message. The Formula Evaluator cannot resolve a circular reference and will not start the process.
Another mistake is not understanding the difference between a cell reference and its value. When you click "Evaluate," Excel shows you the value that the reference points to. For example, if cell A1 contains the number 10, and your formula is =A1*2, the first step of the evaluation will show the number 10, not the letter "A1." This is the correct and expected behavior. If you want to see the original reference, you can look at the formula in the dialog box itself.
Users also often forget that the Formula Evaluator evaluates the formula in its current state. If you change a value in a cell that the formula depends on, you must click the "Evaluate" button again to see the new result. The evaluation process is not dynamic; it is a snapshot of the formula at the moment you clicked the button.
Tips
Start with the simplest formulas. If you are debugging a large, complex spreadsheet, it is often easier to break the problem down. Test a small, simple formula first to make sure the Formulas tab is working and you understand the basic steps. Then, move on to more complex parts of your workbook.
Use the "Trace Precedents" and "Trace Dependents" arrows. These are powerful visual tools found on the Formulas tab. "Trace Precedents" draws arrows pointing to the cells that provide data to the selected cell. "Trace Dependents" draws arrows pointing to the cells that rely on the selected cell’s data. These arrows can help you understand the structure of your data and quickly identify where a mistake might have originated.
Be careful with array formulas. The Formula Evaluator in older versions of Excel could be very slow or fail to work correctly with complex array formulas. In modern versions of Excel, array formulas are much more efficient, and the Formula Evaluator generally handles them well, but it is still a good practice to test them on a small subset of data first.
Troubleshooting
If the "Evaluate Formula" button is grayed out and you cannot click it, it is usually because the active cell does not contain a formula. Ensure you have clicked on a cell that has an equals sign (=) in its formula bar before trying to open the dialog box.
If the evaluation box shows a #NAME? error, it means Excel does not recognize one of the names in your formula. This could be a typo in a function name (like SUMM instead of SUM), a typo in a named range, or the use of a function that is not available in your version of Excel or your Excel language settings.
If the evaluation box shows a #VALUE! error, it means there is a type mismatch. For example, you might be trying to multiply a text string by a number, or you might be using a function that requires a specific type of argument. The step-by-step evaluation will help you pinpoint exactly which part of the formula is causing the type error.
If the evaluation gets stuck in an infinite loop, it is likely a circular reference. The Formula Evaluator will not complete the process. You must fix the circular reference in your spreadsheet before you can use the tool.
Frequently Asked Questions
Can I save a formula evaluation as a picture?
No, the Formula Evaluator is a debugging tool and does not have a built-in "Save as Image" feature. You can take a screenshot of the dialog box if you need to show someone the intermediate steps.
Does the Formula Evaluator work on mobile versions of Excel?
No, the Formula Evaluator is not available in the mobile apps for Excel on iOS or Android. It is a feature of the desktop application.
What if a cell contains a volatile function like TODAY or RAND?
The evaluation will show the value of that function based on the computer’s clock at the moment of evaluation. Because these functions change every time the spreadsheet recalculates, the result in the evaluation box will differ from what is displayed in the cell if the spreadsheet has been recalculated since you opened the dialog box.
Can I use the Formula Evaluator on shared workbooks?
Yes, you can. The evaluation happens locally on your computer. It does not change the workbook on the shared server.
Is there a shortcut key for the Formula Evaluator?
There is no universal keyboard shortcut for the Formula Evaluator dialog box in Excel. You must use the ribbon menu to access it.