# Calculating weighted average

**URL:** https://forum.kirupa.com/t/calculating-weighted-average/271155
**Category:** flash
**Created:** [September 19, 2008, 5:59am UTC](https://forum.kirupa.com/t/calculating-weighted-average/271155 "2008-09-19T05:59:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![skone](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@skone](https://forum.kirupa.com/u/skone)
#### Post date: [September 19, 2008, 5:59am UTC](https://forum.kirupa.com/t/calculating-weighted-average/271155/1 "2008-09-19T05:59:07Z")

</div>

I’m using the below AS but it just doesn’t seem to be working…

Looks like the actionscript referencing is OK it just seems to be getting stuck on the / in the result\_product calculation.

Let me know if this needs further explanation. I’d have no problem posting the source fla

function onCalculate() {  
one = Number(number\_one);  
two = Number(number\_two);  
three = Number(number\_three);  
four = Number(number\_four);  
ten = Number(number\_ten);  
eleven = Number(number\_eleven);  
twelve = Number(number\_twelve);  
thirteen = Number(number\_thirteen);  
result\_sum = one + two + three + four;  
result\_product = ((one \* ten) + (two \* twelve) + (three \* thirteen) + (four \* fourteen)) / (one + two + three + four);  
}
