PERCENTOF function
Returns the share a subset represents of a total: SUM(subset) divided by SUM(all). Microsoft 365.
Available in Microsoft 365 (current channel) and Excel for the web; not in Excel 2021 or 2024 perpetual
Microsoft 365 onlyNot in Google Sheets
Syntax
PERCENTOF(data_subset, data_all)| Argument | What it means | |
|---|---|---|
data_subset | Required | The values that make up the part. |
data_all | Required | All the values that make up the whole. |
Returns: A decimal fraction (format it as a percentage), e.g. 0.46 for 46%.
How PERCENTOF works
PERCENTOF answers "what share of the total is this?" in one function. It adds the first set of values, adds the second set and divides: =PERCENTOF(B2:B3, B2:B5) gives the share of the first half-year in annual sales. On its own it is the same as =SUM(B2:B3)/SUM(B2:B5); the result is a fraction, so apply a percentage format.
Its real purpose is to work as a calculation inside GROUPBY and PIVOTBY. When you pass PERCENTOF as the function argument, Excel automatically uses each group as the subset and the whole column as the total, producing a "percent of grand total" column just like a PivotTable's Show Values As option, but with a formula that updates live.
Examples
1Share of the first half-year
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Quarter | Sales | ||
| 2 | Q1 | 18400 | 46.08% | |
| 3 | Q2 | 22150 | ||
| 4 | Q3 | 19600 | ||
| 5 | Q4 | 27850 |
Result: 46.08%
(18,400 + 22,150) / 88,000 = 0.4608, shown as 46.08% with a 0.00% format.
2Percent of total by category with GROUPBY
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Category | Sales | |||
| 2 | Hardware | 4200 | Hardware | 36.5% | |
| 3 | Software | 6100 | Services | 19.1% | |
| 4 | Hardware | 2300 | Software | 44.4% | |
| 5 | Services | 3400 | Total | 100.0% | |
| 6 | Software | 1800 |
GROUPBY sorts the categories and computes each group's share of 17,800 sales, plus a Total row. The values column is formatted as 0.0%.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NAME? | Your Excel version does not have PERCENTOF. | Use =SUM(subset)/SUM(all) instead. |
#DIV/0! | The total of data_all is zero. | Check the data or wrap in IFERROR. |
Tips
- Apply a % number format, otherwise you will see 0.4608 instead of 46.08%.
- Inside GROUPBY and PIVOTBY, write
PERCENTOFwithout brackets; Excel supplies the arguments.
Google Sheets
Divide the two sums yourself, for example SUMIF(A:A, "East", B:B) / SUM(B:B).
PERCENTOF in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Hungarian | SZÁZALÉK |
| Norwegian (Bokmål) | PROSENTAV |
| Polish | PROCENT |
| Russian | ПРОЦЕНТ |