Create your own formula in a PivotTable or PivotChart report

Microsoft Office Excel 2003

  • Decide whether you want a calculated field or a calculated item within a field.

    Use a calculated field when you want to use the data from another field in your formula. Use a calculated item when you want your formula to use data from one or more specific items within a field.

  • Do one of the following. For best results in a PivotChart report, work in the associated PivotTable report, where you can see the individual data values that your formula calculates.

    ShowAdd a calculated field

    1. Click the report.
    2. On the PivotTable toolbar, click PivotTable or PivotChart, point to Formulas, and then click Calculated Field.
    3. In the Name box, type a name for the field.
    4. In the Formula box, enter the formula for the field.

      To use the data from another field in the formula, click the field in the Fields box, and then click Insert Field. For example, to calculate a 15% commission on each value in the Sales field, you could enter = Sales * 15%.

    5. Click Add, and then click OK.

    ShowAdd a calculated item to a field

    1. If items in the field are grouped, right-click each group, point to Group and Outline on the shortcut menu, and then click Ungroup.
    2. Click the field where you want to add the calculated item.
    3. On the PivotTable toolbar, click PivotTable or PivotChart, point to Formulas, and then click Calculated Item.
    4. In the Name box, type a name for the calculated item.
    5. In the Formula box, enter the formula for the item.

      To use the data from an item in the formula, click the item in the Items list, and then click Insert Item (the item must be from the same field as the calculated item).

    6. Click Add, and then click OK.
    7. If you ungrouped items in step 1, regroup them if you want.
  • For calculated items, you can enter different formulas cell by cell.

    ShowHow?

    For example, if a calculated item named Strawberries has a formula of =Oranges * .25 across all months, you can change the formula to =Oranges *.5 for June, July, and August.

    1. Click a cell for which you want to change the formula.

      To change the formula for several cells, hold down CTRL and click the additional cells.

    2. In the formula bar, type the changes to the formula.
  • If you have multiple calculated items or formulas, adjust the order of calculation.

    ShowHow?

    1. Click the report.
    2. On the PivotTable toolbar, click PivotTable or PivotChart, point to Formulas, and then click Solve Order.
    3. Click a formula, and then click Move Up or Move Down.
    4. Continue until the formulas are in the order that you want them to be calculated.
  • Note  When you add a formula to a PivotChart report or its associated PivotTable report, some chart formatting may be lost.

    ShowTip

    You can display a list of all the formulas in your report. Click the report, click PivotTable or PivotChart on the PivotTable toolbar, point to Formulas, and then click List Formulas.