HomeStatistics & Probability › Weighted Average Calculator

Weighted Average Calculator

Computes the weighted arithmetic mean Σ(w·x) / Σw of a list of values and a matching list of weights, along with the total weight and the unweighted mean for comparison.

When to use

Values contribute unequally to an average: course grades with credit weights, portfolio returns by allocation, survey answers with sampling weights, average price over different quantities.

Do not use when: All items count equally (use descriptive-statistics for the plain mean), or the weights are probabilities of outcomes (use expected-value, which also gives the variance).

Formula

weighted_average = Σ(values_i × weights_i) / Σ weights_i

Inputs

ParameterTypeUnitRequiredDescription
valuesnumber_listyesThe values to average.
weightsnumber_listyesNon-negative weight for each value, in the same order (percentages, credits, quantities); they need not sum to 1.

Outputs

OutputTypeUnitDescription
weighted_averagenumberΣ(values × weights) / Σweights.
total_weightnumberSum of the weights.
weighted_sumnumberΣ(values × weights) before dividing by the total weight.
simple_averagenumberPlain arithmetic mean of the values, for comparison.
countintegerNumber of value/weight pairs.

Example

Grades 90, 80, 70 weighted 50/30/20 %: {"values":[90,80,70],"weights":[0.5,0.3,0.2]}{"weighted_average":83,"total_weight":1,"weighted_sum":83,"simple_average":80,"count":3}

4, 8, 15 with weights 2, 1, 1: {"values":[4,8,15],"weights":[2,1,1]}{"weighted_average":7.75,"total_weight":4,"weighted_sum":31,"simple_average":9}

GET https://tttkmbb.com/api/v1/calculate/weighted-average?values=90%2C80%2C70&weights=0.5%2C0.3%2C0.2

Machine access

Sources

FAQ

Do the weights have to add up to 1 or 100?

No. The result is divided by the total weight, so 50/30/20, 5/3/2 and 0.5/0.3/0.2 all give the same average.

What if a weight is zero?

That value is ignored. At least one weight must be positive; negative weights are rejected.

Related calculators