Calculate Done Percentages by Country in an Excel PivotTable
Question details
Calculate the percentage of Done items among items whose status is not Exclude, grouped by country and product attributes.

- Product
- Microsoft Excel PivotTable
- Device & OS
- not provided
- Scenario
- The user wants a PivotTable with a column for each country and rows for a product hierarchy such as brand, category, and model.
- Observed behavior
- Each group should show the number of Done items divided by the number of items whose status is not Exclude.
Check that the source data has a Status column, a Country column, and the product fields you want to group. Confirm that status values are consistently spelled Done and Exclude.
Use helper columns and a PivotTable calculated field
Use this approach in a standard Excel PivotTable to calculate completion percentages for each country and product group.
The Done flag supplies the numerator, and the Included flag supplies the denominator. The calculated field divides their sums within each PivotTable group.
In the source data, add a column named Done Flag. If the data is an Excel table, enter =IF([@Status]="Done",1,0) in the first data row and fill it down.
Add a column named Included Flag and enter =IF([@Status]<>"Exclude",1,0). Fill it down. This counts every status other than Exclude, including blank statuses.
Select the source data and choose Insert > PivotTable. In the PivotTable Fields pane, drag Country to Columns and the desired product fields, such as Brand, Category, and Model, to Rows.
Drag Done Flag and Included Flag to Values. Open Value Field Settings for each and select Sum if it is not already selected.
Select the PivotTable, then choose PivotTable Analyze > Fields, Items & Sets > Calculated Field. Name the field Done Percentage, enter ='Done Flag'/'Included Flag', and click Add or OK. Open Value Field Settings > Number Format for the new field and choose Percentage.

Calculate country completion rates in WPS Spreadsheets
Use helper columns and a PivotTable in WPS Spreadsheets to total Done and included items, then divide the totals in worksheet cells.
- 1. Add status flags: Open the workbook in WPS Spreadsheets. Add Done Flag and Included Flag columns; for a Status value in D2, enter =IF(D2="Done",1,0) and =IF(D2<>"Exclude",1,0), then fill both formulas down.
- 2. Create the PivotTable: Select the source data and choose Insert > PivotTable. Place Country in Columns, product fields in Rows, and both flag fields in Values, summarized by Sum.
- 3. Divide the totals: In an empty area outside the PivotTable, divide each group's Done total by its Included total. For example, if those totals are in B5 and C5, enter =IFERROR(B5/C5,""). Repeat for the other groups and countries.
- 4. Format the results: Select the result cells and use Home > Percentage Style. Check the cell references again if the PivotTable layout changes.

Frequently Asked Questions
Why can't I use the PivotTable's Show Values As percentage option?
Options such as % of Column Total use PivotTable totals as their denominator. This calculation needs Done items divided specifically by items whose status is not Exclude, so use separate flags and divide their sums.
Does the Included flag count blank statuses?
Yes. The formula =IF([@Status]<>"Exclude",1,0) counts blanks because they are not Exclude. If blanks should also be excluded, use =IF(AND([@Status]<>"Exclude",[@Status]<>""),1,0).
How do I show a separate percentage for each country?
In the PivotTable Fields pane, drag Country to Columns and place the product fields in Rows. Add the Done Percentage calculated field to Values.
What should I do after changing the source statuses?
Update the helper formulas for any new rows, then select the PivotTable and choose PivotTable Analyze > Refresh. If the source range does not include new rows, update it using Change Data Source.
Can I add this calculated field to a Data Model PivotTable?
Standard PivotTable calculated fields are not available for Data Model or OLAP PivotTables. For those, create a measure in the Data Model or Power Pivot that divides the sum of Done Flag by the sum of Included Flag.




