Calculating Average

Hi All,

I’m having a hard time figuring out the average using the math function. I dont know what im doing wrong. The math looks like this:

[[VAR1 + VAR2 / 2]]
and i tried
[[VAR1 + VAR2 * .5]]

Im trying to make something like this happen:
10 + 5 / 2 = 7.5

What am i doing wrong?

Order of operations.

You want to use this formula to calculate a mean average:

[[ (VAR1 + VAR2) / 2 ]]

Division is higher priority than addition so that operation happens first. You need to first sum the components and then divide that sum by the number of components. To specify this in code, as well as standard algebra, you wrap your summation in parentheses. Think of this as specifying it as “one group” or the result of the addition as “one value” within the parentheses. The computer will do just that–add add the numbers within the parentheses and divide that value by 2.

1 Like

Thank you @mbc66! Much appreciated.