# Best way to calculate and average a list of X*Y items.

Question asked by stevenkw on Apr 21, 2011
Latest reply on Apr 21, 2011 by philmodjunk

### Title

Best way to calculate and average a list of X*Y items.

### Post

Hello All,

I was wondering if there is a simple and easy way to calculate and average a list of X*Y numbers.

I currently do this with a (not so pretty) looping script. The data is entered like this:

1*2.18

1*2.33

7*1.18

6*1.38

1*1.70

2*.36

1*.66

2*.54

15*.54

And the script multiplies and sums the results, sums the number of items on the left of the *, then divides the result by the number of items giving the average.

33.31 / 36 = .9252777777777778

I would like to do this without a script and would like the entry to be less cumbersome.

I was thinking of creating a field where the user could enter the data in 1 line. as in:

1*2.18+1*2.33+7*1.18+6*1.38+1*1.70+2*.36+1*.66+2*.54+15*.54

Then some how calculate the total\number of items.

Any thoughts on this?

Thank you,

--StevenKW