Skip to content
MeasureMate

Weighted Average Calculator

Calculate the weighted mean of any list of values and weights, with the normalized weights and each value’s contribution shown.

Values and weights

Weights can be counts, credits, dollars or percentages; they do not need to add up to 100.

28
Weighted average

Σ(w × x) = 5,600, Σw = 200, so 5,600 ÷ 200 = 28. The simple (unweighted) average is 27.666667.

How each row is normalized
ValueWeightNormalizedContribution
254020%5
306030%9
2810050%14

Updated Formula covered by automated tests

A weighted average lets some values count more than others. Enter each value next to its weight, which can be a count, a share, a number of credits, a dollar amount or any other measure of importance, and the tool returns the weighted mean, the plain mean for comparison, and a table showing each row’s normalized weight and how much it contributes to the final figure.

The weights do not have to add up to 1 or to 100. Shares bought in three lots, hours spent at different pay rates, survey groups of different sizes and products sold at different prices are all naturally weighted by counts that add up to whatever they add up to. The calculator divides by the total weight for you and shows that normalization step, so you can see that weights of 40, 60 and 100 behave exactly like 20%, 30% and 50%.

Comparing the weighted result with the simple average is often the most useful part. When the two differ a lot, a few heavy rows are dominating, which is worth knowing before you quote the figure in a report or use it to make a decision.

The formula

x̄w = Σ(wᵢ × xᵢ) ÷ Σwᵢ
Normalized weight pᵢ = wᵢ ÷ Σwᵢ, so x̄w = Σ(pᵢ × xᵢ)
xᵢ
The i-th value, in whatever unit the values share (dollars, points, degrees)
wᵢ
The weight of the i-th value; must be zero or positive and is unit-free relative to the other weights
Σwᵢ
Total weight; the result is undefined if this is zero
pᵢ
Normalized weight, the fraction of the total that row i represents; the pᵢ always sum to 1
x̄w
The weighted mean, in the same unit as the values

The weighted mean is what you get if you imagine each value repeated in proportion to its weight and then take an ordinary average. Forty shares at $25 and sixty at $30 really are a hundred individual shares, so the fair average price is the total spent divided by the total shares, not the midpoint of the two prices.

Dividing every weight by the total turns them into proportions that add to one, which is why the scale of the weights never matters: multiplying all weights by 10 multiplies both the numerator and the denominator by 10. The contribution column, pᵢ × xᵢ, adds up exactly to the weighted mean, so it shows at a glance which rows are doing the work.

Worked example

Diego bought the same stock three times: 40 shares at $25.00, 60 shares at $30.00 and 100 shares at $28.00. He needs his average cost per share to work out his gain when he sells.

  1. 1 Multiply each price by its number of shares: 40 × 25 = 1,000; 60 × 30 = 1,800; 100 × 28 = 2,800.
  2. 2 Add the products and the weights: 1,000 + 1,800 + 2,800 = 5,600 dollars spent on 40 + 60 + 100 = 200 shares.
  3. 3 Divide: 5,600 ÷ 200 = $28.00 per share.
  4. 4 Check with normalized weights: 40 ÷ 200 = 0.2, 60 ÷ 200 = 0.3, 100 ÷ 200 = 0.5, and 0.2 × 25 + 0.3 × 30 + 0.5 × 28 = 5 + 9 + 14 = 28.
  5. 5 Compare with the simple mean of the three prices: (25 + 30 + 28) ÷ 3 = $27.67, which understates his real cost.

Result: Diego’s average cost is $28.00 per share. Using the unweighted $27.67 would overstate his taxable gain by 33 cents on every share.

Before you rely on the result

  • A weighted mean hides spread: a portfolio averaging 5% can contain one holding at 40% and another at -20%. Look at the individual rows before drawing conclusions.
  • Averaging percentages or rates only makes sense when they are weighted by the base they apply to. Average speeds over equal distances, for example, need a harmonic mean rather than this formula.
  • For investment cost basis, brokers and tax authorities may use specific-lot or first-in-first-out rules instead of the average cost; check which method applies before filing.

Frequently asked questions

Do my weights have to add up to 100?

No. Any set of non-negative weights works because the formula divides by their total. Percentages that sum to 100, credit hours, units sold and raw counts all give the correct mean as long as each weight is measured the same way.

Can a weight be zero or negative?

A zero weight is allowed and simply removes that value from the result. Negative weights are rejected: in an everyday average they have no sensible meaning, and they can push the result outside the range of your values. If every weight is zero, there is nothing to average and the tool reports that instead of a number.

When should I use a weighted average instead of a regular one?

Whenever the values represent groups or amounts of different size. Averaging the average test scores of a class of 10 and a class of 30, the price of items bought in different quantities, or interest rates on loans of different balances all need weights; otherwise the small group gets the same say as the large one.

What value do I need next to bring the average up to a target?

Solve the formula for the missing value: x = (target × (Σw + w_new) − Σwx) ÷ w_new. With a current average of 80 on a weight of 3, adding a weight of 1 needs a value of 88 to reach 82. A heavier new weight needs a smaller jump.

All education