A few months ago, I shared my code for listing all the formulas in an Excel workbook. The code creates a new worksheet, with details on each formula’s worksheet name, cell address, the formula and the formula in R1C1 format.
Pivot Table Formulas
If you create calculated fields or calculated items in a pivot table, those formulas are not included in the list of worksheet formulas.
However, you can manually create a formula list, for any pivot table, by using a built-in pivot table command.
List the Formulas in Excel 2010
- Select any cell in the pivot table.
- On the Ribbon, under the PivotTable Tools tab, click the Options tab.
- In the Calculations group, click Fields, Items & Sets
- Click List Formulas.
A new sheet is inserted in the workbook, with a list of calculated fields, followed by a list of calculated items.
Only the formulas in the selected pivot table are listed. If you want to see all the formulas, in all the pivot tables, you’d have to repeat these steps for each pivot table.
Macro Lists All Formulas in All Pivot Tables
Instead of creating the lists manually, you can use programming to create the list for you. I’ve posted sample code and a workbook on my Contextures site, and you can download that to test the macro.
The code adds a new sheet to the workbook, with a list of all the pivot table formulas, with their location and formula.
To download the sample file, go to the Pivot Table Calculated Fields page, and go to the “List All Formulas For All Pivot Tables” section.
Watch the List Formulas Video
To see the steps for creating a list of formulas, for the selected pivot table, watch this short video tutorial.
______________
Hello Debra,
Thanks so much for your Excel tips, information, and blog. You generate vast amounts of positive energy for the Excel community and I appreciate it!
I have a question that I’ve not been able to find the answer to: I have a spreadsheet that has several pivot tables in it. I’d like to port the views created by those pivot tables to a SQL server. Is there a way to see the underlying SQL queries that generate the pivot data? I have your PowerPivot Premium product but don’t see anything in the user interface that provides this data.
Best regards,
Dennis McCreery
@Dennis, Thanks, and I’ve added sample code to my website, to list all the pivot tables in a workbook, along with their source data location, or MDX query.
http://www.contextures.com/excelpivottabledatasource.html#listmdx
I’ll put this on the wish list for the next version of the PivotPower Premium add-in too.
Debra