Does a weighted average, knowing that mathematical average between two numbers is 0.5

Here you can change that by giving the weight of first number in that average, check examples

Function Weighted_Average(Number1, Number2, Num1WeightPercintage)

' Weighted_Average(20, 50,1) = 20 ' 20 has 100% of the average, no avg here, right

' Weighted_Average(20, 50,0.5) = 35 ' Mathematical average, each represents 50%

' Weighted_Average(20, 50,0.9) = 23 ' 20 now has a weight of 90%, while 50 has only 10%

' Weighted_Average(20, 50,0.2) = 44 ' 20 is 20%, 50 has the remaining 80%

Weighted_Average = (Number1 * Num1WeightPercintage) + ( Number2 * (1- Num1WeightPercintage) )

End Function

' Weighted_Average(20, 50,1) = 20 ' 20 has 100% of the average, no avg here, right

' Weighted_Average(20, 50,0.5) = 35 ' Mathematical average, each represents 50%

' Weighted_Average(20, 50,0.9) = 23 ' 20 now has a weight of 90%, while 50 has only 10%

' Weighted_Average(20, 50,0.2) = 44 ' 20 is 20%, 50 has the remaining 80%

Weighted_Average = (Number1 * Num1WeightPercintage) + ( Number2 * (1- Num1WeightPercintage) )

End Function

#### Parameters

Number1, Number2, Num1WeightPercintage

#### Examples

Weighted_Average(20, 50,1) = 20<br/>Weighted_Average(20, 50,0.5) = 35 <br/>Weighted_Average(20, 50,0.9) = 23 <br/>Weighted_Average(20, 50,0.2) = 44

Views 142 Downloads 61