How To Calculate A Weighted Average In Excel (2026)

A plain average treats every number as equally important, which is wrong when some values count more than others.

Excel has no single weighted average button, but Microsoft shows a two-function formula that does the job.

This guide walks through that formula with Microsoft’s price and units example, then a grades example you can adapt.

Table of Contents

Quick answer: the weighted average formula

Your weights areFormula
Any numbers, such as units or credits=SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4)
Percentages that add up to 100%=SUMPRODUCT(A2:A4,B2:B4)

Column A holds the values, column B holds the weights, and both ranges must be the same size.

What a weighted average is

A weighted average multiplies each value by its weight, adds the results, and divides by the total of the weights.

Typical uses are an average price across different order sizes, or a course grade where exams count more than homework.

Excel’s AVERAGE function cannot do this, because it counts every value once.

Microsoft’s example: average price per unit

Microsoft’s average-calculation page uses unit prices and quantities to show the method.

RowA: Price per unitB: Number of units
220500
325750
435200
  1. Type the three rows above into A2:B4.
  2. Click an empty cell, such as D2.
  3. Type =SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4) and press Enter.

Microsoft says this divides the total cost by the total units, and the result is 24.66.

How the formula works

PartWhat it doesValue here
SUMPRODUCT(A2:A4,B2:B4)Multiplies each price by its units and adds the products35,750
SUM(B2:B4)Adds the weights1,450
DivisionTotal cost divided by total units24.66

The 35,750 comes from 20 times 500, plus 25 times 750, plus 35 times 200.

Because the formula divides by the sum of the weights, the weights can be any positive numbers and need not add up to 1 or 100.

Example with percentage weights

When the weights are percentages that add up to 100%, you can skip the division.

RowA: ScoreB: Weight
28520%
39030%
47850%

Type =SUMPRODUCT(A2:A4,B2:B4) in an empty cell and press Enter.

The result is 83, from 17 plus 27 plus 39.

If your weights do not add up to 100%, use the longer formula with SUM so the result is still correct.

Enter weights as percentages

On the Home tab, click Percent Style in the Number group, or press Ctrl+Shift+%.

Microsoft warns that applying the format to cells that already hold numbers multiplies them by 100, so 10 becomes 1000.00%.

Format the empty cells first, or type the weight as a decimal such as 0.2 and then apply Percent Style.

In cells already formatted as percentages and still empty, Microsoft says typing either 10 or 0.1 displays 10.00%.

SUMPRODUCT rules

The syntax is SUMPRODUCT(array1,[array2],[array3],…), and Microsoft says it accepts arrays 2 through 255 beyond the first.

  • Every array must have the same dimensions.
  • Non-numeric entries are treated as zeros.
  • Avoid whole-column references such as A:A, because they force Excel to process about 1,048,576 cells per column.

Use exact ranges like A2:A4 so the formula stays fast.

If you get an error

ProblemCauseFix
#VALUE!Microsoft says it is returned when the array arguments have different dimensions, such as C2:C10 with D2:D5Make both ranges the same size
Result too lowMicrosoft says non-numeric entries are treated as zerosConvert text to numbers
#DIV/0!Logical result of dividing by a total weight of zeroCheck the weight cells

The #DIV/0! row follows from dividing by SUM of the weights, so make sure at least one weight is above zero.

Numbers stored as text are a common cause, and our guide to converting them shows the fix.

For other error codes, see how to fix #N/A, #VALUE! and #REF! errors.

Example with credit hours

The same formula works when the weights are whole numbers such as credit hours.

RowA: Grade pointsB: Credits
243
334
421

Type =SUMPRODUCT(A2:A4,B2:B4)/SUM(B2:B4) and press Enter.

The products are 12, 12, and 2, which total 26, and the credits total 8, so the result is 3.25.

Add more rows later

If you add a new row of data under row 4, extend both ranges in the formula to include it, for example A2:A5 and B2:B5.

A formula that covers only A2:A4 will not pick up the new row, so the answer will be missing that value.

Keep both ranges the same length each time, because a mismatch triggers the #VALUE! error described above.

Check your weights

Before trusting the result, type =SUM(B2:B4) in a spare cell.

With percentage weights it should show 100%, and with other weights it should match the total you expect, such as 1,450 units in Microsoft’s example.

If the total is off, look for a weight that was typed as text, because SUMPRODUCT treats text as zero and SUM skips it, so the total will come out lower than expected.

Which version of the formula to use

SituationUse
Weights are units, credits, or hoursSUMPRODUCT divided by SUM
Weights are percentages that total 100%SUMPRODUCT alone
Weights may not total 100%SUMPRODUCT divided by SUM
All values count equallyAVERAGE

When in doubt, the longer version with SUM is always safe, because dividing by a total of 100% changes nothing.

A weight of 20% is stored as 0.2, so SUM of percentage weights that total 100% returns 1 when shown as a plain number.

Why the parentheses matter

Microsoft says Excel calculates multiplication and division before addition and subtraction, and that parentheses override the order.

Keep SUMPRODUCT(…) and SUM(…) as separate function calls divided by a slash, as in the examples above.

If you add anything else to the formula, wrap that part in brackets so it is calculated first.

Plain average versus weighted average

For Microsoft’s price data, a plain =AVERAGE(A2:A4) gives 26.67, which ignores how many units were bought at each price.

The weighted result of 24.66 is lower because most units were bought at the cheaper prices.

Our guide to calculating the mean, median and mode in Excel covers the plain version.

Official sources

Leave a Reply

Your email address will not be published. Required fields are marked *