Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 25
Default YTD calculation using same cell

I am creating a pipeline that has new data entered each week. I want the
weekly figure to automatically add on to the monthly figure.
Eg.
A B C
1 Weekly Monthly YTD
2 $100 $500 $600

The monthly will get cleared to $0 at the beginning of each month but I want
the YTD to continue increasing. So when I enter a figure into A2, I want it
to add on to C2 as well.
Help please - thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default YTD calculation using same cell

You will have to use VBA to do this but be warned: if you make an mistake on
the input to A2 this be reflected in the Monthly and Yearly totals which
would then have to be corrected manually. Also there is no audit trail of
your transactions.

So may want to review whether this is the best approach.

"Molly" wrote:

I am creating a pipeline that has new data entered each week. I want the
weekly figure to automatically add on to the monthly figure.
Eg.
A B C
1 Weekly Monthly YTD
2 $100 $500 $600

The monthly will get cleared to $0 at the beginning of each month but I want
the YTD to continue increasing. So when I enter a figure into A2, I want it
to add on to C2 as well.
Help please - thanks

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default YTD calculation using same cell

right click sheet tabview codecopy/paste this
this will increase a2 by whatever you input into a2

Private Sub Worksheet_Change(ByVal target As Excel.Range)
If target.Address = "$A$2" Then
On Error GoTo fixit
Application.EnableEvents = False
If target.Value = 0 Then oldvalue = 0
target.Value = 1 * target.Value + oldvalue
oldvalue = target.Value
fixit:
Application.EnableEvents = True
End If
End Sub


--
Don Guillett
SalesAid Software

"Molly" wrote in message
...
I am creating a pipeline that has new data entered each week. I want the
weekly figure to automatically add on to the monthly figure.
Eg.
A B C
1 Weekly Monthly YTD
2 $100 $500 $600

The monthly will get cleared to $0 at the beginning of each month but I
want
the YTD to continue increasing. So when I enter a figure into A2, I want
it
to add on to C2 as well.
Help please - thanks


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default YTD calculation using same cell

One way:

Put this in your worksheet code module (right-click the worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Address(False, False) = "A2" Then
If IsNumeric(.Value) Then
On Error Resume Next
Application.EnableEvents = False
.Offset(0, 1).Value = .Offset(0, 1).Value + .Value
.Offset(0, 2).Value = .Offset(0, 2).Value + .Value
Application.EnableEvents = True
On Error GoTo 0
End If
End If
End With
End Sub


In article ,
Molly wrote:

I am creating a pipeline that has new data entered each week. I want the
weekly figure to automatically add on to the monthly figure.
Eg.
A B C
1 Weekly Monthly YTD
2 $100 $500 $600

The monthly will get cleared to $0 at the beginning of each month but I want
the YTD to continue increasing. So when I enter a figure into A2, I want it
to add on to C2 as well.
Help please - thanks

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
Cell Calculation Kasey Excel Worksheet Functions 5 September 19th 06 10:58 PM
making a cell zero out after calculation chris1bcoo Excel Discussion (Misc queries) 3 May 10th 06 09:11 AM
How do I exclude a cell from an average calculation when the cell. Sam Excel Discussion (Misc queries) 1 September 7th 05 05:16 PM
How to see calculation and heading in same cell. Jeracho Excel Discussion (Misc queries) 2 August 1st 05 04:01 PM
Calculation within a Cell Eric Whittaker New Users to Excel 2 May 8th 05 06:38 PM


All times are GMT +1. The time now is 07:20 AM.

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"