How to Add Calculated Field to Pivot Table in Google Sheets

In Google Sheets, you can't add a calculated field directly to a pivot table, but you can create a new column in the source data and include it in the pivot table. Here's how you can do it:

  1. Open the Google Sheets document containing the source data for your pivot table.
  2. Add a new column to your source data by clicking on the lettered header of the column to the right of where you want the new column to appear, then right-click and select "Insert 1 left" or "Insert 1 right" as needed.
  3. In the new column, add a header in the first row to describe the data (e.g., "Calculated Field").
  4. In the second row of the new column, enter the formula or calculation you want to apply to the data, using cell references from the same row. For example, if you want to calculate the percentage from columns B and C in the same row, you would enter "=B2/C2" (without quotes).
  5. Press Enter, and the formula will be applied to the cell.
  6. Click on the bottom-right corner of the cell containing the formula, and drag it down to fill the entire column with the same formula applied to each row.
  7. Now, go to the sheet containing the pivot table.
  8. Click on any cell in the pivot table to show the "Pivot table editor" panel on the right side of the screen.
  9. In the "Pivot table editor" panel, under the "Rows," "Columns," or "Values" section (depending on where you want to add the calculated field), click on "Add" and select the header of the new column you created in the source data.
  10. The calculated field will now be added to the pivot table.

Example

Let's say you have a dataset with the following columns: Product, Sales, and Expenses. You want to add a calculated field to your pivot table that shows the Profit Margin, which is calculated by dividing Profit (Sales - Expenses) by Sales.

  1. Add a new column to your source data with the header "Profit Margin."
  2. In the second row of the new column, enter the formula "=(B2-C2)/B2" (without quotes), assuming Sales are in column B and Expenses are in column C.
  3. Copy the formula down the entire column.
  4. Go to the sheet containing the pivot table and open the "Pivot table editor" panel.
  5. In the "Pivot table editor" panel, under the "Rows," "Columns," or "Values" section (depending on where you want to add the calculated field), click on "Add" and select "Profit Margin."
  6. The Profit Margin will now be included in the pivot table.
Did you find this useful?