Summing and averaging columns

S

shaggles

I'm creating an exam in access and I want to sum the
columns in each section and then create a weighted average
for each section score. It seems like all the sum and
average functions are act on one column. I tried doing
this: [Column1]+[Column2]+[Column3] but that just gave me
the contents of each column lined up in a row.
 
J

John Spencer (MVP)

Sum, Avg and the other aggregate functions work vertically (down a column), not
horizontally (across a row/record).

If you are doing arithmetic and getting concatenation ( 1+2+3 =6 versus 1+2+3 =
123) Then Access is probably seeing the field values as text vice numeric. You
can try

Val(Nz(Column1,0)) + Val(Nz(Column2,0)) + ...

Val forces the number characters in the field to a number type, while NZ handles
the situation of the field containing a null value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top