Totaling and Averaging columns...?

# Thread: Totaling and Averaging columns...?

1. Sergio Guest

## Totaling and Averaging columns...?

This is my code to write the data from a table to the brower. <BR>Now I want to sum up each column to get a total for each and <BR>the average for the AVG column.<BR>Any ideas?<BR><BR>DO UNTIL rstemp.eof<BR> Player=rstemp("Player")<BR> AVG=rstemp("AVG")<BR> R=rstemp("R")<BR> HR=rstemp("HR")<BR> RBI=rstemp("RBI")<BR> SB=rstemp("SB")<BR> <BR> PlayerCounter = PlayerCounter + 1<BR> &#039 write the fields to browser<BR> cellstart="&#060;td align=""top""&#062;"<BR> response.write "&#060;tr&#062;"<BR> response.write cellstart & PlayerCounter & "&nbsp&nbsp" & Player & "&#060;/td&#062;"<BR> response.write cellstart & AVG & "&#060;/td&#062;"<BR> response.write cellstart & R & "&#060;/td&#062;" <BR> response.write cellstart & HR & "&#060;/td&#062;"<BR> response.write cellstart & RBI & "&#060;/td&#062;"<BR> response.write cellstart & SB & "&#060;/td&#062;"<BR><BR> response.write "&#060;/tr&#062;"<BR> rstemp.movenext<BR>LOOP

2. jd
Senior Member
Join Date
Dec 1969
Posts
850

## depends...

That depends...<BR><BR>If you are asking for a numeric average, simply add the numbers up and divide by the quantity of rows (iterations). <BR><BR>However, my guess is that AVG in this case means batting average. Is that so? If so, you will also need to take into account &#039At Bats&#039 (and to be totally accurate, you may also need &#039Base on Balls&#039 and &#039Hit by Pitcher&#039, no?)<BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•