Formula Auditing

Home Search Site Map

Up
Add-Ins...
AutoCorrect Options...
Compare & Merge...
Customize...
Error Checking...
Formula Auditing
Goal Seek...
Macro
Online Collaboration
Options...
Protection
Research...
Scenarios...
Shared Workspace...
Share Workbook...
Speech
Spelling...
Track Changes

New! Excel User Group Now Open @ www.excelusergroup.org,

UK EXCEL USER CONFERENCE - LONDON, UK. APRIL 1st/2nd 2009 - TOTALLY FREE - DETAILS CAN BE CHECKED OUT HERE! Check It Out!


Menu command Type What happens next?
Formula Auditing

Shows a sub menu with all the options for checking the results of formulae, particularly if you are not getting the result you expected! The sub-menu is shown below, together with explanations of the options.

Trace Precedents

Draws a line(s) to the active cell, (Which must contain a valid formula) to the cell(s) on which the active cell relies upon for it's value.  The arrow points to the active cell. (You can see the formula of the active cell in the formula bar (=A9+C9)).

If there is an external precedent/dependent, (a reference to another sheet or workbook), a line is drawn as below with a 'sheet' icon.

Trace Dependents

Draws a line(s) from the active cell, to the cell(s) which rely on the active cell(s) value.  The arrow points away from the active cell. (The formula in A8 is =A1+1)

Repetitive pressing of either the dependents or precedents option, moves the lines around, 'tracing' the path of the formula, as below.

Double clicking an 'internal' arrow. (one referring to a cell on the same sheet) will 'hyperlink you to that cell. Double-clicking the line of an 'external' link, (one referring to another sheet or workbook), will launch the 'Go To' dialog, with the address available to select, (as below).

Trace Error

After highlighting an error cell, this option draws arrows to the cells creating it, as below.

Remove All Arrows

Removes all the precedent and dependent arrows from a particular worksheet.

Evaluate Formula

Allows you, via the dialog below to 'step' through a complex formula, looking at the value at different points.  This enables you to discover at which point the formula you have fails or returns an unexpected value.

You can 'Step In' or Step Out' to different levels of the formula and evaluate the component parts from the formula, to the value they represent. In the example above, Sheet1!$A$9 has already been evaluated to the constant '1000', Sheet1!$A$1 is showing as the formula A9+C9. A9 is underlined, so pressing 'Evaluate' at this point will replace A9 with the value 1000. C9 would then be underlined. Press it again and the value of C9 would be shown, with the next press the old formula A9+C9 will be 'Evaluated' to a constant and the next level moved up to.

Show Watch Window

Allows you to add or delete 'watches' so that you can 'watch' values in several cells in one convenient location. The 'Add Watch...' button allows you to select several cells at once.  This functionality has be 'borrowed' from VBA where the watch window is a must for debugging code and 'watching' the value and condition of variables. It presents the floating dialog below.

The column headers can be clicked on to sort the data, so for example you could click on sheet to sort the 'watches' in sheet order.

Formula Auditing Mode

This mode, which can be accessed also by the shortcut key Ctrl+`, shows the 'formula layer' of the worksheet. It widens the columns so you can fully see the formulae.  This makes it very easy to spot a rouge formula. Taking this option again, or pressing Ctrl+` again, toggles the view back to normal and contracts the column widths. (Both views shown below).

'Normal' View

'Formula' View

Show Formula Auditing Toolbar

Shows the toolbar allowing you to more easily, repetitively, select dependants, precedents, clear all or just precedent/dependent arrows, etc.

VBA Sub TraceFormulaPrecDep()
Dim wb As Workbook
Dim wks1 As Worksheet
Dim wks2 As Worksheet
Set wb = Workbooks.Add
Set wks1 = wb.Worksheets("Sheet1")
Set wks2 = wb.Worksheets("Sheet2")
With wks2
.Range("A1").Formula = "=Sheet1!$B$1"
End With
With wks1
.Range("A1").Value = 1000
.Range("A25").Formula = "=$A$1"
.Range("B1").Value = 1000
.Range("A25").ShowPrecedents
.Range("B1").ShowDependents
End With
End Sub

Top

Copyright Nick Hodge 2008. All Rights Reserved.