Spreadsheet Practice

How to calculate each category's share of the total in Excel

Formula (Excel and Google Sheets)

=SUMIF($A$2:$A$11,E2,$B$2:$B$11)/SUM($B$2:$B$11)

Sum the category with SUMIF and divide by the grand total: =SUMIF($A$2:$A$11,E2,$B$2:$B$11)/SUM($B$2:$B$11).

Result on the example
one result per row in F2, filled down to F4
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in F2, filled down to F4. Change any input and the result updates, or edit the formula to experiment.

How it works

SUMIF adds up the amounts for the category next to the formula: Housing comes to 2,135. Dividing by the total of every amount, 2,753.75, gives its share: 77.5%. The data ranges are locked with $, so only E2 changes as you fill down, and the three shares add up to 100%.

=SUMIF($A$2:$A$11,E2,$B$2:$B$11)/SUM($B$2:$B$11)

Result0.7753064004

  1. $A$2:$A$1110 rows × 1 col: "Housing", "Food", "Transport", "Food", …

    A range: 10 cells in one column.

  2. E2"Housing"

    The value in E2.

  3. $B$2:$B$1110 rows × 1 col: $1,800.00, $120.50, $60.00, $85.25, …

    A range: 10 cells in one column.

  4. SUMIF($A$2:$A$11,E2,$B$2:$B$11)2135

    SUMIF: Adds values where the range meets a condition.

    • range$A$2:$A$1110 rows × 1 col: "Housing", "Food", "Transport", "Food", …
    • criteriaE2"Housing"
    • sum_range$B$2:$B$1110 rows × 1 col: $1,800.00, $120.50, $60.00, $85.25, …
  5. SUM($B$2:$B$11)2753.75

    SUM: Adds numbers and ranges. Skips text and blanks.

    • number1$B$2:$B$1110 rows × 1 col: $1,800.00, $120.50, $60.00, $85.25, …
  6. SUMIF($A$2:$A$11,E2,$B$2:$B$11)/SUM($B$2:$B$11)0.7753064004

    The / operator divides.

In Google Sheets

The same formula works in Google Sheets: =SUMIF($A$2:$A$11,E2,$B$2:$B$11)/SUM($B$2:$B$11). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=SUMPRODUCT(($A$2:$A$11=E2)*$B$2:$B$11)/SUM($B$2:$B$11)77.5%, 17.5%, 5.0%The same share with SUMPRODUCT, which can take extra conditions such as a month test.

Common mistakes

  • Without $ on the ranges, they shift as you fill down and later categories miss rows.
  • A category spelled two ways ("Food" and "Groceries") splits its share. Clean the labels, or the shares won't mean much.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Calculate each category's share of the total

In F2, calculate the category in E2 as a share of total spending, then fill down to F4.

Questions

How do I list the categories automatically?

In Excel 365 or Google Sheets, put =UNIQUE(A2:A11) in E2 and fill the share formula beside it.

Can a pivot table show this?

Yes: put Category in Rows and Amount in Values, then Show Values As, % of Grand Total.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.