Summing columns

S

scottwilsonx

Hi.

Could someone tell me how to tackle the following.
I have a worksheet with data as follows:

Column C and Column D and Column F have data which I want to summaris
at the bottom of the spreadsheet, say line 600.

Column C - I want to calculate the average value
Column D - I want to calculate the average value
Column F - I want to sum all the values

Can this be done?

Many thanks for your help.
Scott
 
D

Don Guillett

try this
Sub averageandsum()
x = Cells(Rows.Count, "c").End(xlUp).Row
Cells(x + 2, "c") = Application.Average(Range("c2:c" & x))
Cells(x + 2, "d") = Application.Average(Range("d2:d" & x))
Cells(x + 2, "f") = Application.Sum(Range("f2:f" & x))
End Sub
 
P

Paul B

Scott, use this in row 600, or am I missing something?

=AVERAGE(C1:C599)
=AVERAGE(D1:D599)
=SUM(F1:F599)

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
 
P

Paul B

Missed it was in programming!
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **

Paul B said:
Scott, use this in row 600, or am I missing something?

=AVERAGE(C1:C599)
=AVERAGE(D1:D599)
=SUM(F1:F599)

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
** remove news from my email address to reply by email **
 
R

Rodney POWELL

Scott --


With worksheet formulas it's like this :

C600 : =AVERAGE(C1:C599)

D600 : =AVERAGE(D1:D599)

F600 : =SUM(F1:F599)


Using VBA -- here's the procedure :

Sub MyCalcs()

With Worksheets("MySheetName")
.Range("C600").Value = Application.Average(.Range("C1:C599"))
.Range("D600").Value = Application.Average(.Range("D1:D599"))
.Range("F600").Value = Application.Sum(.Range("F1:F599"))
End With

End Sub

-----

Hope it Helps,

- Rodney POWELL
Microsoft MVP - Excel

Beyond Technology
Spring, Texas USA
www.BeyondTechnology.com



Hi.

Could someone tell me how to tackle the following.
I have a worksheet with data as follows:

Column C and Column D and Column F have data which I want to summarise
at the bottom of the spreadsheet, say line 600.

Column C - I want to calculate the average value
Column D - I want to calculate the average value
Column F - I want to sum all the values

Can this be done?

Many thanks for your help.
Scott.
 
Top