Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to list all formulas in Excel?

Normally, in Excel, we can quickly display formulas in the cells, but, Excel doesn’t provide a feature for listing all formulas in a worksheet. Listing all formulas of a worksheet can help us to keep trace of the cell values with its real formulas. Here, I can talk about creating a VBA code to solve this problem.

List all formulas of a worksheet with VBA code


arrow blue right bubble List all formulas of a worksheet with VBA code


The following VBA code will help you to list the formulas of a selection or a worksheet, please do as follows:

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: List all formulas of a worksheet

Sub ListFormulas()
'Update 20141027
Dim Rng As Range
Dim WorkRng As Range
Dim xSheet As Worksheet
Dim xRow As Integer
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.SpecialCells(xlFormulas, 23)
If WorkRng Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Set xSheet = Application.ActiveWorkbook.Worksheets.Add
xSheet.Range("A1:C1") = Array("Address", "Formula", "Value")
xSheet.Range("A1:C1").Font.Bold = True
xRow = 2
For Each Rng In WorkRng
    xSheet.Cells(xRow, 1) = Rng.Address(RowAbsolute:=False, ColumnAbsolute:=False)
    xSheet.Cells(xRow, 2) = " " & Rng.Formula
    xSheet.Cells(xRow, 3) = Rng.Value
    xRow = xRow + 1
Next
xSheet.Columns("A:C").AutoFit
Application.ScreenUpdating = True
End Sub

3. Then press F5 key to run this code, and a prompt box will pop out to remind you to select a range or the whole worksheet that you want to list its formula cells, see screenshot:

doc-list-formulas-1

4. And then click OK, formulas in your selection have been listed at once in a new worksheet in the front of your active worksheet which contains the information of cell address, formula and value as following screenshot shown:

doc-list-formulas-1


Related articles:

How to convert formula to text string in Excel?

How to convert text strings to formulas in Excel?


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Chris · 10 months ago
    Thanks for the code, but Excel keeps saying: variable not defined (highlights: xTitleId = "KutoolsforExcel")
    Any advice?

    Best regards
  • To post as a guest, your comment is unpublished.
    Bigbadclock · 11 months ago
    Nice work: I would like to make a small addition

    1)Your code needs: Dim xTitleId as String
    2) doesn't say whether the formulas are array formulas or just simple ones.



    Cheers.
  • To post as a guest, your comment is unpublished.
    william · 1 years ago
    mannn thanks a lot you saved the day
  • To post as a guest, your comment is unpublished.
    JJJJJJ · 1 years ago
    ur mum gay