Skip to main content

How to list all formulas in Excel?

Author: Xiaoyang Last Modified: 2014-11-05

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?

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thanks for the code, but Excel keeps saying: variable not defined (highlights: xTitleId = "KutoolsforExcel")
Any advice?

Best regards
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
mannn thanks a lot you saved the day
This comment was minimized by the moderator on the site
ur mum gay
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations