Excel Supreme

Excel track · Exercise 83 of 86 Paid

A headcount and payroll summary

Total a payroll across two columns, then divide it by the headcount.

Advanced

Four teams with headcount and salary, summarised two ways

Read-only data · screen 1 of 2 · answer in D2

In D2, total the payroll the whole sheet implies.

ABCD
1TeamHeadsSalaryAnswer
2Sales345000
3Support238000
4Sales241000
5Ops152000

Download this grid (.xlsx) Two tabs: the grid you see, and the answer.

D2

What it does

SUMPRODUCT multiplies two ranges row by row, then adds the products. Given heads in B2:B5 and salaries in C2:C5, each team's headcount pairs with that team's salary before anything is summed. Three heads at 45000 come to 135000, and the four rows come to 345000.

The second screen divides that payroll by the total headcount, eight, and rounds: 345000 across eight heads is 43125. The divisor is SUM(B2:B5), so a team of three carries three times the weight of a team of one. Averaging the salary column gives 44000, a figure nobody on the sheet is paid.

Both ranges need the same shape; one that starts a row late pairs each salary with the wrong headcount, and the total is still a number. The divisor comes from the heads column: COUNT(B2:B5) counts four rows and would put the cost at 86250.

Syntax

=SUMPRODUCT(heads,salaries) totals a payroll; divide by SUM(heads) for the cost per head

Worked example

On Four teams with headcount and salary, summarised two ways, =SUMPRODUCT(B2:B5,C2:C5) returns 345000.

=SUMPRODUCT(B2:B5,C2:C5)

Common errors

Error codes for SUMPRODUCT pairing headcount with salary, then a per-head ratio over it
ErrorWhat it means and how to fix it
#VALUE!The two ranges are different shapes, so the rows cannot be paired.
#DIV/0!The headcount total is zero and the cost per head divides by it.
Wrong divisorThe divisor counts rows instead of heads, so four teams divide a payroll built on eight.

At work

Costing a monthly payroll from headcount and salary columns that both move.