Table of Contents
F2 key in Excel - edit formulas
Editing directly in a cell or in the formula bar
F9 key in Excel - evaluate formula parts
Excel F9 tips:
Debug a formula by using the Evaluate Formula feature
Highlight and match parenthesis pairs in a formula
Highlight all cells referenced in a given formula
Highlight all formulas that reference a selected cell
Trace relationships between formulas and cells in Excel
Trace Precedents - show cells that supply data to a given formula
Trace Dependents - show formulas that reference a given cell
Monitor formulas and their calculated values (Watch Window)
How to add cells to the Watch window
How to remove cells from the Watch Window
How to move and dock the Watch Window
Home Software Tutorial Office Software How to edit, evaluate and debug formulas in Excel

How to edit, evaluate and debug formulas in Excel

Apr 25, 2025 am 09:52 AM

In this tutorial, you will learn a few quick and efficient ways to check and debug formulas in Excel. See how to use the F9 key to evaluate formula parts, how to highlight cells that reference or are referenced by a given formula, how to determine mismatched or misplaced parentheses, and more.

In the last few tutorials, we have been investigating different aspects of Excel formulas. If you've had a chance to read them, you already know how to write formulas in Excel, how to show formulas in cells, how to hide and lock formulas, and more.

Today, I'd like to share a few tips and techniques to check, evaluate and debug Excel formulas that will hopefully help you work even more efficiently with Excel.

F2 key in Excel - edit formulas

The F2 key in Excel toggles between Edit and Enter modes. When you want to make changes to an existing formula, select the formula cell and press F2 to enter the Edit mode. Once you do this, the cursor starts flashing at the end of the closing parenthesis in the cell or formula bar (depending on whether the Allow editing directly in cells option is checked or unchecked). And now, you can make any edits in the formula:

  • Use the left and right arrows to navigate within the formula.
  • Use the arrow keys together with Shift to select the formula parts (the same can be done using the mouse).
  • Press Delete or Backspace to delete certain cell references or other elements of the formula.

When you are done editing, press Enter to complete the formula.

To exit the Edit mode without making any changes to the formula, press the Esc key.

Editing directly in a cell or in the formula bar

By default, pressing the F2 key in Excel positions the cursor at the end of the formula in a cell. If you prefer editing formulas in the Excel formula bar, do the following:

  • Click File > Options.
  • In the left pane, select Advanced.
  • In the right pane, uncheck the Allow editing directly in cells option under Editing Options.
  • Click OK to save the changes and close the dialog.

How to edit, evaluate and debug formulas in Excel

These days, F2 is often considered an old-fashioned way to edit formulas. Two other ways to enter the Edit mode in Excel are:

  • Double clicking the cell, or
  • Clicking anywhere within the formula bar.

Is Excel's F2 approach more efficient or does it have any advantages? Nope :) Simply some people prefer working from the keyboard most of the time while others find it more convenient to use the mouse.

Whichever editing method you choose, a visual indication of the Edit mode can be found at the bottom-left corner of the screen. As soon as you press F2, or double click the cell, or click the formula bar, the word Edit will appear right below the sheet tabs:

How to edit, evaluate and debug formulas in Excel

Tip. Press Ctrl A to jump from editing a formula in a cell to the formula bar. It only works when you are editing a formula, not a value.

F9 key in Excel - evaluate formula parts

In Microsoft Excel, F9 key is an easy and quick way to check and debug formulas. It lets you evaluate only the selected part of the formula by replacing it with the actual values that part operates on, or with the calculated result. The following example demonstrates Excel's F9 key in action.

Supposing you have the following IF formula in your worksheet:

=IF(AVERAGE(A2:A6)>AVERAGE(B2:B6),"Good","Bad")

To evaluate each of the two Average functions included in the formula individually, do the following:

  • Select the cell with the formula, D1 in this example.
  • Press F2 or double click the selected cell to enter the Edit mode.
  • Select the formula part you want to test and press F9.

For example, if you select the first Average function, i.e. AVERAGE(A2:A6), and press F9, Excel will display its calculated value:

How to edit, evaluate and debug formulas in Excel

If you select only the cell range (A2:A6) and press F9, you will see the actual values instead of the cell references:

How to edit, evaluate and debug formulas in Excel

To exit the formula evaluation mode, press the Esc key.

Excel F9 tips:

  • Be sure to select some part of your formula before pressing F9, otherwise the F9 key will replace the entire formula with its calculated value.
  • When in the formula evaluation mode, don't press the Enter key because this would replace the selected part either with the calculated value or cell values. To retain the original formula, press the Esc key to cancel the formula testing and exit the formula evaluation mode.

The Excel F9 technique is especially useful for testing long complex formulas, such as nested formulas or array formulas, where it's difficult to understand how the formula calculates the final result because it includes a few intermediate calculations or logical tests. And this debugging method lets you narrow down an error to a particular range or function causing it.

Debug a formula by using the Evaluate Formula feature

Another way to evaluate formulas in Excel is the Evaluate Formula option that resides on the Formulas tab, in the Formula Auditing group.

How to edit, evaluate and debug formulas in Excel

As soon as you click this button, the Evaluate Formula dialog box will pop up, where you can inspect each part of your formula in the order the formula is calculated.

All you need to do is click the Evaluate button and examine the value of the underlined formula part. The result of the most recent evaluation appears in italics.

How to edit, evaluate and debug formulas in Excel

Continue clicking the Evaluate button until each part of your formula has been tested.

To end the evaluation, click the Close button.

To start the formula evaluation from the beginning, click Restart.

If the underlined part of the formula is a reference to a cell containing another formula, click the Step In button to have that other formula displayed in the Evaluation box. To get back to the previous formula, click Step Out.

How to edit, evaluate and debug formulas in Excel

Step In button to evaluate another formula that the underlined part refers to." title="Click the Step In button to evaluate another formula that the underlined part refers to." width="530" style="max-width:90%">

Note. The Step In button is not available for a cell reference pointing to another formula in a different workbook. Also, it is not available for a cell reference that appears in the formula for the second time (like the second instance of D1 in the screenshot above).

Highlight and match parenthesis pairs in a formula

When creating sophisticated formulas in Excel, you often need to include more than one pair of parentheses to specify the order of calculations or nest a few different functions. Needless to say, it's very easy to misplace, omit, or include an extra parenthesis in such formulas.

If you miss or misplace a parenthesis and hit the Enter key attempting to complete the formula, Microsoft Excel usually displays an alert suggesting to fix the formula for you:

How to edit, evaluate and debug formulas in Excel

If you agree to the suggested correction, click Yes. If the edited formula is not what you want, click No and make the corrections manually.

Note. Microsoft Excel does not always fix missing or mismatched parentheses correctly. Therefore, always review the proposed correction carefully before accepting it.

To help you balance the parenthesis pairs, Excel provides three visual clues when you are typing or editing a formula:

  • When entering a complex formula that contains multiple sets of parenthesis, Excel shades parenthesis pairs in different colors to easier identify them. The outside parenthesis pair is always black. This can help you determine whether you have inserted the right number of parenthesis in your formula.
  • When you type the closing parenthesis in a formula, Excel briefly highlights the parenthesis pair (the right parenthesis you've just typed and the matching left parenthesis). If you've typed what you think is the last closing parenthesis in a formula and Excel doesn't bold the opening one, your parentheses are mismatched or unbalanced.
  • When you navigate within a formula using the arrow keys and cross over a parenthesis, the other parenthesis in the pair gets highlighted and formatted with the same color. In this way, Excel tries to make parenthesis pairing more evident.

In the following screenshot, I've crossed over the last closing parenthesis using the arrow key, and the outside parenthesis pair (black ones) got highlighted:

How to edit, evaluate and debug formulas in Excel

Highlight all cells referenced in a given formula

When you are debugging a formula in Excel, it might be helpful to view the cells referenced in it. To highlight all of the dependent cells, do the following:

  • Select the formula cell and press the Ctrl [ shortcut. Excel will highlight all the cells your formula refers to, and moves the selection to the first referenced cell or a range of cells.
  • To navigate to the next referenced cell, press Enter.

In this example, I selected cell F4 and pressed Ctrl [ . Two cells (C4 and E4) referenced in F4's formula got highlighted, and the selection moved to C4:

How to edit, evaluate and debug formulas in Excel

Highlight all formulas that reference a selected cell

The previous tip demonstrated how you can highlight all the cells referenced in a certain formula. But what if you want to do the reverse and find out all the formulas that refer to a particular cell? For example, you might want to delete some irrelevant or outdated data in a worksheet, but you want to make sure the deletion won't break any of your existing formulas.

To highlight all cells with formulas that reference a given cell, select that cell, and press the Ctrl ] shortcut.

Like in the previous example, the selection will move to the first formula on the sheet that references the cell. To move the selection to other formulas that reference that cell, press the Enter key repeatedly.

In this example, I've selected cell C4, pressed Ctrl ] and Excel immediately highlighted the cells (E4 and F4) containing a C4 reference:

How to edit, evaluate and debug formulas in Excel

Trace relationships between formulas and cells in Excel

Another way to visually display cells relating to a certain formula is to use the Trace Precedents and Trace Dependents buttons that reside on the Formulas tab > Formula Auditing group.

Trace Precedents - show cells that supply data to a given formula

The Trace Precedents button works similarly to the Ctrl [ shortcut, i.e. shows which cells provide data to the selected formula cell.

The difference is that the Ctrl [ shortcut highlights all cells referenced in a formula, while clicking the Trace Precedents button draws blue trace lines from the referenced cells to the selected formula cell, as demonstrated in the following screenshot:

How to edit, evaluate and debug formulas in Excel

To get precedents lines to appear, you can also use the Alt T U T shortcut.

Trace Dependents - show formulas that reference a given cell

The Trace Dependents button works similarly to the Ctrl ] shortcut. It shows which cells are dependent on the active cell, i.e. which cells contain formulas referencing a given cell.

In the following screenshot, cell D2 is selected, and the blue trace lines point to the formulas that contain D2 references:

How to edit, evaluate and debug formulas in Excel

Another way to display dependents line is clicking the Alt T U D shortcut.

Tip. To hide the trace arrows, click the Remove Arrows button that resides right belowTrace Dependents.

Monitor formulas and their calculated values (Watch Window)

When you are working with a large data set, you may want to keep an eye on the most important formulas in your workbook and see how their calculated values change when you edit the source data. Excel's Watch Window was created just for this purpose.

The Watch Window displays the cell properties, such as the workbook and worksheet names, cell or range name if any, cell address, value, and formula, in a separate window. In this way, you can always see the most important data at a glance, even when you are switching between different workbooks!

How to edit, evaluate and debug formulas in Excel

How to add cells to the Watch window

To display the Watch Window and add cells to monitor, perform the following steps:

  1. Select the cell(s) that you want to watch.

    Tip. If you want to monitor all the cells with formulas on an active sheet, go to the Home tab > Editing group, click Find & Replace, then click Go To Special, and select Formulas.

  2. Switch to the Formulas tab > Formula Auditing group, and click Watch Window.

    How to edit, evaluate and debug formulas in Excel

  3. The Watch Window will appear and you click the Add Watch… button.

    How to edit, evaluate and debug formulas in Excel

Watch Window notes:

  • You can add only one watch per cell.
  • Cells that have external references to other workbook(s) are displayed only when those other workbooks are open.

How to remove cells from the Watch Window

To delete a certain cell(s) from the Watch Window, select the cell you want to remove, and click the Delete Watch button:

How to edit, evaluate and debug formulas in Excel

Tip. To delete several cells in one go, press Ctrl and select the cells you want to remove.

How to move and dock the Watch Window

Like any other toolbar, Excel's Watch Window can be moved or docked to the top, bottom, left, or right side of the screen. To do this, just drag the Watch Window using the mouse to the location you want.

For example, if you dock the Watch Window to the bottom, it will always show up just below your sheet tabs, and let you comfortably inspect the key formulas without having to repeatedly scroll up and down to the formula cells.

How to edit, evaluate and debug formulas in Excel

And finally, I'd like to share a couple more tips that might prove helpful for evaluating and debugging your Excel formulas.

Formula debugging tips:

  1. To view a long formula entire without overlaying the contents of neighboring cells, use the formula bar. If the formula is too long to fit into the default formula bar, expand it by pressing Ctrl Shift U or drag its lower border using the mouse as demonstrated in How to expand the formula bar in Excel.
  2. To see all formulas on the sheet instead of their results, press Ctrl ` or click the Show Formulas button on the Formulas tab. Please see How to show formulas in Excel for full details.

This is how to evaluate and debug formulas in Excel. If you know more efficient ways, please do share your debugging tips in comments. I thank you for reading and hope to see you on our blog next week!

The above is the detailed content of How to edit, evaluate and debug formulas in Excel. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1249
24
If You Don't Rename Tables in Excel, Today's the Day to Start If You Don't Rename Tables in Excel, Today's the Day to Start Apr 15, 2025 am 12:58 AM

Quick link Why should tables be named in Excel How to name a table in Excel Excel table naming rules and techniques By default, tables in Excel are named Table1, Table2, Table3, and so on. However, you don't have to stick to these tags. In fact, it would be better if you don't! In this quick guide, I will explain why you should always rename tables in Excel and show you how to do this. Why should tables be named in Excel While it may take some time to develop the habit of naming tables in Excel (if you don't usually do this), the following reasons illustrate today

How to change Excel table styles and remove table formatting How to change Excel table styles and remove table formatting Apr 19, 2025 am 11:45 AM

This tutorial shows you how to quickly apply, modify, and remove Excel table styles while preserving all table functionalities. Want to make your Excel tables look exactly how you want? Read on! After creating an Excel table, the first step is usual

Excel MATCH function with formula examples Excel MATCH function with formula examples Apr 15, 2025 am 11:21 AM

This tutorial explains how to use MATCH function in Excel with formula examples. It also shows how to improve your lookup formulas by a making dynamic formula with VLOOKUP and MATCH. In Microsoft Excel, there are many different lookup/ref

Excel: Compare strings in two cells for matches (case-insensitive or exact) Excel: Compare strings in two cells for matches (case-insensitive or exact) Apr 16, 2025 am 11:26 AM

The tutorial shows how to compare text strings in Excel for case-insensitive and exact match. You will learn a number of formulas to compare two cells by their values, string length, or the number of occurrences of a specific character, a

How to Make Your Excel Spreadsheet Accessible to All How to Make Your Excel Spreadsheet Accessible to All Apr 18, 2025 am 01:06 AM

Improve the accessibility of Excel tables: A practical guide When creating a Microsoft Excel workbook, be sure to take the necessary steps to make sure everyone has access to it, especially if you plan to share the workbook with others. This guide will share some practical tips to help you achieve this. Use a descriptive worksheet name One way to improve accessibility of Excel workbooks is to change the name of the worksheet. By default, Excel worksheets are named Sheet1, Sheet2, Sheet3, etc. This non-descriptive numbering system will continue when you click " " to add a new worksheet. There are multiple benefits to changing the worksheet name to make it more accurate to describe the worksheet content: carry

Don't Ignore the Power of F4 in Microsoft Excel Don't Ignore the Power of F4 in Microsoft Excel Apr 24, 2025 am 06:07 AM

A must-have for Excel experts: the wonderful use of the F4 key, a secret weapon to improve efficiency! This article will reveal the powerful functions of the F4 key in Microsoft Excel under Windows system, helping you quickly master this shortcut key to improve productivity. 1. Switching formula reference type Reference types in Excel include relative references, absolute references, and mixed references. The F4 keys can be conveniently switched between these types, especially when creating formulas. Suppose you need to calculate the price of seven products and add a 20% tax. In cell E2, you may enter the following formula: =SUM(D2 (D2*A2)) After pressing Enter, the price containing 20% ​​tax can be calculated. But,

5 Open-Source Alternatives to Microsoft Excel 5 Open-Source Alternatives to Microsoft Excel Apr 16, 2025 am 12:56 AM

Excel remains popular in the business world, thanks to its familiar interfaces, data tools and a wide range of feature sets. Open source alternatives such as LibreOffice Calc and Gnumeric are compatible with Excel files. OnlyOffice and Grist provide cloud-based spreadsheet editors with collaboration capabilities. Looking for open source alternatives to Microsoft Excel depends on what you want to achieve: Are you tracking your monthly grocery list, or are you looking for tools that can support your business processes? Here are some spreadsheet editors for a variety of use cases. Excel remains a giant in the business world Microsoft Ex

How to Use Excel's AGGREGATE Function to Refine Calculations How to Use Excel's AGGREGATE Function to Refine Calculations Apr 12, 2025 am 12:54 AM

Quick Links The AGGREGATE Syntax

See all articles