Math & trig function

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)
ArgumentWhat it means
data_subsetRequiredThe values that make up the part.
data_allRequiredAll 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

D2fx=PERCENTOF(B2:B3, B2:B5)
ABCD
1QuarterSales
2Q11840046.08%
3Q222150
4Q319600
5Q427850

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

D2fx=GROUPBY(A2:A6, B2:B6, PERCENTOF)
ABCDE
1CategorySales
2Hardware4200Hardware36.5%
3Software6100Services19.1%
4Hardware2300Software44.4%
5Services3400Total100.0%
6Software1800

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%.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 14 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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 PERCENTOF without 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.

LanguageFunction name
HungarianSZÁZALÉK
Norwegian (Bokmål)PROSENTAV
PolishPROCENT
RussianПРОЦЕНТ

Recipes that use PERCENTOF