+ Reply to Thread
Results 1 to 3 of 3

Running Totals Formulas

  1. #1
    Jaime
    Guest

    Running Totals Formulas

    I am trying to figure out a macro or a formula that will allow me to keep a
    running total when one cell in the formula is constantly changing.

    Example:

    Cell B6 contains the number 7 (total for this week)
    Cell B35 contains the number 36 (year to date total including the 7 for this
    week)

    I want to be able to change cell B6 and have the new amount added to the 36
    in cell B35 and the answer to that total, replace the year to date total in
    Cell B35.

    So, if cell B6 changes to 9 (total for the week) then I want the B35 total
    to change to the 36 year to date pluse the 9 for the new weekly total and
    ultimately replace the B35 cell number of 36 with the answer which is 45.

    Does anyone know how I can do this?

  2. #2
    Jim Thomlinson
    Guest

    RE: Running Totals Formulas

    Here is some code for you. At each change in Cell B6, it adds the value of B6
    to the existing value of B35 to make a new total in B35. Right click on the
    sheet tabe where you want the code and select view code (this can not be in a
    regular module) and add this code...

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$B$6" Then
    Range("B35").Value = Range("B35").Value + Target.Value
    End If
    End Sub
    --
    HTH...

    Jim Thomlinson


    "Jaime" wrote:

    > I am trying to figure out a macro or a formula that will allow me to keep a
    > running total when one cell in the formula is constantly changing.
    >
    > Example:
    >
    > Cell B6 contains the number 7 (total for this week)
    > Cell B35 contains the number 36 (year to date total including the 7 for this
    > week)
    >
    > I want to be able to change cell B6 and have the new amount added to the 36
    > in cell B35 and the answer to that total, replace the year to date total in
    > Cell B35.
    >
    > So, if cell B6 changes to 9 (total for the week) then I want the B35 total
    > to change to the 36 year to date pluse the 9 for the new weekly total and
    > ultimately replace the B35 cell number of 36 with the answer which is 45.
    >
    > Does anyone know how I can do this?


  3. #3
    Jaime
    Guest

    RE: Running Totals Formulas

    Thank you! Thank you! Thank you!

    This makes my job a TON easier.

    "Jim Thomlinson" wrote:

    > Here is some code for you. At each change in Cell B6, it adds the value of B6
    > to the existing value of B35 to make a new total in B35. Right click on the
    > sheet tabe where you want the code and select view code (this can not be in a
    > regular module) and add this code...
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > If Target.Address = "$B$6" Then
    > Range("B35").Value = Range("B35").Value + Target.Value
    > End If
    > End Sub
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "Jaime" wrote:
    >
    > > I am trying to figure out a macro or a formula that will allow me to keep a
    > > running total when one cell in the formula is constantly changing.
    > >
    > > Example:
    > >
    > > Cell B6 contains the number 7 (total for this week)
    > > Cell B35 contains the number 36 (year to date total including the 7 for this
    > > week)
    > >
    > > I want to be able to change cell B6 and have the new amount added to the 36
    > > in cell B35 and the answer to that total, replace the year to date total in
    > > Cell B35.
    > >
    > > So, if cell B6 changes to 9 (total for the week) then I want the B35 total
    > > to change to the 36 year to date pluse the 9 for the new weekly total and
    > > ultimately replace the B35 cell number of 36 with the answer which is 45.
    > >
    > > Does anyone know how I can do this?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1