Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Accessing Dependent and Precedent Information.

Accessing Dependent and Precedent Information

Written by Allen Wyatt (last updated February 28, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


3

David rightly notes that Excel provides auditing tools (Trace Dependents and Trace Precedents) that are a very helpful way of keeping track of what is happening in large worksheets. However, the actual interface just lists out the cells in a small area, and David cannot easily copy out this list of cells to analyze and manipulate it. When he uses Trace Dependents on an important cell in a large worksheet, the small dialog box can contain several hundred references. David wonders if there is a relatively easy way of getting this information into a more usable format, like a blank worksheet or another workbook.

There is obviously no way to do this with native Excel commands, but you can create a macro that will extract the information you desire. The following macro will list the dependent cells for whatever cell is selected when you run the macro:

Sub ListDependents()
    Dim rArea As Range
    Dim rCell As Range
    Dim rDep As Range
    Dim lRow As Long
    Dim sCellAddr As String

    sCellAddr = ActiveCell.Address(False, False)
    On Error Resume Next
    Set rDep = ActiveCell.Dependents
    If rDep Is Nothing Then
        MsgBox sCellAddr & " has no dependents"
        Exit Sub
    End If

    On Error GoTo 0
    Worksheets.Add
    lRow = 1
    Cells(lRow, 1).Value = "Dependents for " & sCellAddr
    For Each rArea In rDep
        For Each rCell In rArea
            lRow = lRow + 1
            Cells(lRow, 1) = rCell.Address(False, False)
        Next
    Next
    Set rArea = Nothing
    Set rCell = Nothing
    Set rDep = Nothing
End Sub

When the macro is first run, it checks to see if there are any dependents for the cell. If there aren't, then you are notified, and the macro is exited. If there are dependents, then a new worksheet is added to the workbook and the dependents of the cell are added to the worksheet.

If you want the macro to instead list precedents, all you need to do is change the all instances of "Dependents" in the macro to "Precedents."

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8271) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Accessing Dependent and Precedent Information.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Retrieving Drive Statistics

Need to gather some information about the drives on a system? It can be pretty easy to do using a macro, as shown in this ...

Discover More

Missing Row Numbers

By default, Excel shows row numbers at the left side of your program window. If you cannot see the row numbers, there are ...

Discover More

Controlling Where a Full-page Border is Printed

When you add full-page borders to your document, you may be bothered to find out that one or more sides of the border ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Tracing Precedents and Dependents Clears Undo Stack

Excel normally allows you to undo actions you take so that you can "step back" through what you may have been doing. ...

Discover More

Counting with Subtotals

There are a variety of ways you can count information in different groupings. One convenient way is to use the ...

Discover More

Excel Refuses to Put Page Breaks between Subtotal Groups

Page breaks not appearing where you expect them in your subtotaled data? It could be because of a setting you made in ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 + 7?

2023-03-02 09:38:46

Craig M Bower

@J. Woolley
Thank you.


2023-03-01 10:31:20

J. Woolley

https://excelribbon.tips.net/T008271_Accessing_Dependent_and_Precedent_Information.html

@Craig Bower
Yes. The ReportDents macro in My Excel Toolbox will trace direct precedents and dependents for each cell in the active sheet's Selection and report results in a separate '...dents' worksheet with each row including hyperlinks to the source cell and its precedent or dependent target range (which might be on a different worksheet or workbook). For example, if 'Sheet1'!$A$1 contains the formula
=SUM('Sheet2'!$B$1:$B$9)
then the '...dents' sheet will include hyperlinks to 'Sheet1'!$A$1 and its precedent range 'Sheet2'!$B$1:$B$9.
See https://sites.google.com/view/MyExcelToolbox/


2023-02-28 10:06:25

Craig Bower

I like the macro presented in this tip, but I note that it only will trace the dependents located on the worksheet of the selected cell. It does not list the dependents located on other worksheets of the workbook. Is there a way to list the dependents on other worksheets? Most of the time when I use the actual tracing interface, you are not able to read the entire traced cell name listed.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.