How to Add Custom Calculated Fields to Pivot Tables in Excel

Download Article
Easily customize your pivot table in Microsoft Excel with this in-depth guide
Download Article

Do you want to add more information to your pivot table without altering your source data? You easily can add custom calculated fields to create formulas within the pivot table instead of adding more columns to your worksheet. Custom fields can do nearly any calculations you need, like displaying averages, percentages, variances, and maximum values for fields. We'll walk you through adding a custom calculated field to a pivot table in your Microsoft Excel spreadsheet, and show you how to edit the field any time you need to change the formula.

Method 1
Method 1 of 2:

Adding Custom Fields

Download Article
  1. How.com.vn English: Step 1 Open your workbook.
    Double-click the file that has the source data and pivot table you'll be working with.
    • Keep in mind that calculated fields can't use references or named ranges in formulas—this means you can't use functions like INDEX, OFFSET, or VLOOKUP in your custom field. However, functions like IF, SUM, COUNT, and any others that don't require references or named ranges are fine.
  2. How.com.vn English: Step 2 Click the pivot table you want to edit.
    When you click the pivot table, the "PivotTable Fields" panel will expand on the right. You'll also see the PivotTable Analyze menu at the top of Excel.
    Advertisement
  3. How.com.vn English: Step 3 Click the PivotTable Analyze tab.
    You'll see this tab at the top of Excel.
    • The PivotTable Analyze menu is only visible when you click to activate the pivot table. If the menu ever disappears, just click the pivot table again to bring it back up.
    • This tab is called Analyze in some versions of Excel.
  4. How.com.vn English: Step 4 Click the Fields, Items, & Sets menu.
    You'll see this in the "Calculations" area of the toolbar at the top of Excel.
  5. How.com.vn English: Step 5 Click Calculated Field….
    Once you click this menu option, the "Insert Calculated Field" dialog box will appear.[1]
  6. How.com.vn English: Step 6 Enter a name for the field.
    Type a descriptive column label for your custom field into the "Name" box.
  7. How.com.vn English: Step 7 Create a formula for your custom field.
    In the "Formula" box, type the formula you want to use to calculate your custom field.
    • For example, to find the tax rate for the "Items" field at 8.5%, you could name your custom field "Tax" and use this formula:=Items * 8.5%.
    • Another example: If you want to divide values in the "Sales" column by values in the "Quantity" column, you could use: =Sales/Quantity.
    • To insert data from another pivot table field in your formula, select the field and click Insert Field.
  8. How.com.vn English: Step 8 Click Add.
    This adds your custom field to the Fields list.
  9. How.com.vn English: Step 9 Click OK.
    This closes the "Insert Calculated Field" box and returns you to the pivot table.
  10. Step 10 Find your new field in the "Values" area.
    Now that you've added a new field, you'll see it in the "PivotTable Fields" panel on the right side of your sheet in the "Values" column.
  11. How.com.vn English: Step 11 Drag your new field to the desired area.
    You can now drag your custom calculated field from the Values area to Filters, Rows, or Columns to apply the formula to your data.
  12. Advertisement
Method 2
Method 2 of 2:

Editing Custom Fields

Download Article
  1. How.com.vn English: Step 1 Select the pivot table containing the field you want to edit.
    Editing the formula in this one calculated field is much easier than creating—and later editing—a formula in the source data. This can be useful when the amount by which you are calculating your field changes often. Clicking the pivot table will activate the PivotTable Analyze or Analyze menu at the top of Excel.
  2. How.com.vn English: Step 2 Click the PivotTable Analyze or Analyze tab.
    You'll see these at the top of Excel.
  3. How.com.vn English: Step 3 Click the Fields, Items, & Sets menu.
    You'll see this in the "Calculations" area of the toolbar at the top of Excel.
  4. How.com.vn English: Step 4 Click Calculated Field….
    Once you click this menu option, the "Insert Calculated Field" dialog box will appear.
  5. How.com.vn English: Step 5 Select the field you want to edit.
    All fields, including your custom fields, appear in the "Fields" area. When you click your custom field, you'll see its formula in the "Formula" box, and its name in the "Name" box.
  6. How.com.vn English: Step 6 Modify the field's name or formula.
    You can now make any adjustments you need to your custom field.
    • If you want to delete the field, just click Delete instead.
  7. How.com.vn English: Step 7 Click OK.
    Your field is now updated. If your pivot table doesn't refresh automatically, right-click the table and select Refresh to see your new calculations.
  8. Advertisement

Expert Q&A

Search
Add New Question
  • Question
    Every time that I create a new pivot table and I select a field (revenue) and I move it to values space, it defaults to count of revenue even though I've used sum of revenue in previous pivot tables.
    How.com.vn English: Nicole Levine, MFA
    Nicole Levine, MFA
    How.com.vn Technology Writer
    Nicole Levine is a Technology Writer and Editor for How.com.vn. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
    How.com.vn English: Nicole Levine, MFA
    How.com.vn Technology Writer
    Expert Answer
    It would default to count instead of sum if there are any blank cells or errors in your data--if you have any of either, replace them with 0 (zeros) and that should sort if out. If that doesn't work, you might have non-numerical characters in your data (or numbers that are formatted as text instead of numbers). Make sure your data is purely numerical and you should get a sum instead of the count.
  • Question
    How can I add a new field to the Filters or Rows section of the Pivot Table?
    How.com.vn English: Nicole Levine, MFA
    Nicole Levine, MFA
    How.com.vn Technology Writer
    Nicole Levine is a Technology Writer and Editor for How.com.vn. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
    How.com.vn English: Nicole Levine, MFA
    How.com.vn Technology Writer
    Expert Answer
    Once you create the new field, it will appear in the "Values" section of the PivotTable Fields panel on the right side of your sheet. To use the value as a filter, drag it over to the Filters section.
  • Question
    I would like to display the number of occurrences (count) of incidences where where column A is less than 100 when Column C is equal to a given value.
    How.com.vn English: Nicole Levine, MFA
    Nicole Levine, MFA
    How.com.vn Technology Writer
    Nicole Levine is a Technology Writer and Editor for How.com.vn. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
    How.com.vn English: Nicole Levine, MFA
    How.com.vn Technology Writer
    Expert Answer
    The COUNTIFS formula would get you that result, but you can't use that function in a calculated field. You might want to add a new column to your source data that contains an IFS statement, which you can count in your pivot table without adding any calculated fields.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Video

      Tips

      • Calculated fields in a pivot table calculate against the sum totals, not against individual rows.[2] You will need to insert a column and formula in the source data if you need a calculation by individual rows.
      • It's not possible to use a calculated field as a report filter or slicer.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!
      Advertisement

      About This Article

      How.com.vn English: Nicole Levine, MFA
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for How.com.vn. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions. This article has been viewed 518,779 times.
      How helpful is this?
      Co-authors: 12
      Updated: March 25, 2024
      Views: 518,779
      Categories: Spreadsheets
      Thanks to all authors for creating a page that has been read 518,779 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement