Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    1

    Unanswered: 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.

  2. #2
    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

Posting Permissions

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