If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > cumulative total

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-04, 15:40
dcaputo dcaputo is offline
Registered User
 
Join Date: Oct 2004
Posts: 1
cumulative total

I am trying to get a cumulative total from numbers being entered in the same cell every week. I have the following worksheet:
First week:
/ A / B / C /
/ 1 / water / cumulative / starting /
/ 2 / 20 / 70 / 50 /

Second week:
/ A / B / C /
/ 1 / water / cumulative / starting /
/ 2 / 10 / 80 / 50

And so on...
I will enter a value in cell A2 everyweek and I want cell B2 to keep a running total.

Thanks for the help. I i didn't explain the good enough, please let me know.
Reply With Quote
  #2 (permalink)  
Old 10-02-04, 11:28
Smitty Smitty is offline
Registered User
 
Join Date: Dec 2003
Location: San Diego, CA
Posts: 153
Welcome to the Board!

You need a bit of VBA for that:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
Set rng = Range("A2")
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
' Add A2's value to B2
[B2] = [B2] + [A2]
End Sub

Right click the worksheet tab and select View Code. Paste the code into the module window that opens, then ALT+Q to exit back to Excel.

Type a number into A2 and see what happens.

Hope that helps,

Smitty
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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