Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sum a column

To sum all the numbers in column A...
=SUM(a1:a11)
To sum all the numbers in column B...
=SUM(b1:b11)

----- newbie04 wrote: -----

i have a series of data :

2 2
5 5
7
1 1
0 0
3 3
6 6
10
2 2
9 9
11

The LHS is the original data while the RHS is the data i wanna obtain.
My doubts is that what is the code for summing?

Thank you.


---
Message posted from http://www.ExcelForum.com/


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum a column

but how abt if my number is represent by an alphabet?

To sum all the numbers in column A...
=SUM(a1:a11)

To sum all the numbers in column B...
=SUM(b1:b11)

If my 1=i, 11=j,
then how do i do this?


---
Message posted from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Sum a column

newbie04,
In code you need something like:
activecell.Formaula="=SUM(B" & i & ":B" & j & ")"

NickHK

"newbie04 " wrote in message
...
but how abt if my number is represent by an alphabet?

To sum all the numbers in column A...
=SUM(a1:a11)

To sum all the numbers in column B...
=SUM(b1:b11)

If my 1=i, 11=j,
then how do i do this?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum a column

Sub testing()


z = 0
For m = 3 To Sheets.Count
For i = 6 To 200
If Worksheets(m).Cells(i, 15) = Worksheets(m).Cells(i + 1, 15) Then
z = z + 1
Else
If Worksheets(m).Cells(i, 15) < Worksheets(m).Cells(i + 1, 15) An
Worksheets(m).Cells(i, 1) < "" Then
Worksheets(m).Rows(i + 1).Font.Bold = True
Worksheets(m).Cells(i + 1, 9) = "=SUM(I" & (i - z) & ":I" & i
")"
Worksheets(m).Cells(i + 1, 10) = "=SUM(J" & (i - z) & ":J" & i
")"
Worksheets(m).Cells(i + 1, 11) = "=SUM(K" & (i - z) & ":K" & i
")"
Worksheets(m).Cells(i + 1, 13) = "=SUM(M" & (i - z) & ":M" & i
")"
z = 0
End If
End If
Next i
Next m

End Sub


Here's the code. i seem alrite to run in single sheet, but error
happen when it has to do the task over several sheets.
I guess the error are the SUM.... as it is not defined which column t
be taken from the sheets.

So how i can solve this?

Thks

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Sum a column

newbie04,
Comments in line.

Also, what errors are you getting ?

NickHK


"newbie04 " wrote in message
...
Sub testing()


z = 0
For m = 3 To Sheets.Count
For i = 6 To 200


'---- Use With Worksheets(m) to tidy the code --------
If Worksheets(m).Cells(i, 15) = Worksheets(m).Cells(i + 1, 15) Then
z = z + 1
Else


'------ Not needed as you tested this above and must be true to reach
re --
If Worksheets(m).Cells(i, 15) < Worksheets(m).Cells(i + 1, 15) And
Worksheets(m).Cells(i, 1) < "" Then
Worksheets(m).Rows(i + 1).Font.Bold = True
Worksheets(m).Cells(i + 1, 9) = "=SUM(I" & (i - z) & ":I" & i &
")"
Worksheets(m).Cells(i + 1, 10) = "=SUM(J" & (i - z) & ":J" & i &
")"
Worksheets(m).Cells(i + 1, 11) = "=SUM(K" & (i - z) & ":K" & i &
")"
Worksheets(m).Cells(i + 1, 13) = "=SUM(M" & (i - z) & ":M" & i &
")"
z = 0
End If
End If
Next i
Next m

End Sub


Here's the code. i seem alrite to run in single sheet, but errors
happen when it has to do the task over several sheets.
I guess the error are the SUM.... as it is not defined which column to
be taken from the sheets.

So how i can solve this?

Thks.


---
Message posted from http://www.ExcelForum.com/





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
divide column(x) by column(y) to give column(x/y) in excel? James New Users to Excel 2 April 24th 23 11:46 AM
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
what formula do i put for column m = column k minus column l in e. jenniss Excel Discussion (Misc queries) 5 January 6th 05 08:18 PM


All times are GMT +1. The time now is 03:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"