PC Review


Reply
Thread Tools Rate Thread

Cummulative Totals

 
 
=?Utf-8?B?Q2FybGVl?=
Guest
Posts: n/a
 
      23rd Sep 2007
Hi all,

I use the code below to produce cummulative totals for a given month (Days
1-31)

Issue:
If i use this code to produce a row of data, for a mid-month report,
specifically a graph, where i run out of data, the unknown days contain the
last known value.

Question:
How can tell the code that if there is no value for the date, display a '0',
otherwise, calculate the cummunlative value for the day in question.



Code:
Range("C58") = Range("C11")
Range("D58") = Application.WorksheetFunction.Sum(Range("C58,D11"))
Range("E58") = Application.WorksheetFunction.Sum(Range("D58,E11"))
Range("F58") = Application.WorksheetFunction.Sum(Range("E58,F11"))
Range("G58") = Application.WorksheetFunction.Sum(Range("F58,G11"))
Range("H58") = Application.WorksheetFunction.Sum(Range("G58,H11"))

Range("I58") = Application.WorksheetFunction.Sum(Range("H58,I11"))

Range("J58") = Application.WorksheetFunction.Sum(Range("I58,J11"))
Range("K58") = Application.WorksheetFunction.Sum(Range("J58,K11"))
Range("L58") = Application.WorksheetFunction.Sum(Range("K58,L11"))
Range("M58") = Application.WorksheetFunction.Sum(Range("L58,M11"))

Range("N58") = Application.WorksheetFunction.Sum(Range("M58,N11"))
Range("O58") = Application.WorksheetFunction.Sum(Range("N58,O11"))
Range("P58") = Application.WorksheetFunction.Sum(Range("O58,P11"))
Range("Q58") = Application.WorksheetFunction.Sum(Range("P58,Q11"))
Range("R58") = Application.WorksheetFunction.Sum(Range("Q58,R11"))

Range("S58") = Application.WorksheetFunction.Sum(Range("R58,S11"))
Range("T58") = Application.WorksheetFunction.Sum(Range("S58,T11"))
Range("U58") = Application.WorksheetFunction.Sum(Range("T58,U11"))
Range("W58") = Application.WorksheetFunction.Sum(Range("V58,W11"))

Range("X58") = Application.WorksheetFunction.Sum(Range("W58,X11"))
Range("Y58") = Application.WorksheetFunction.Sum(Range("X58,Y11"))
Range("Z58") = Application.WorksheetFunction.Sum(Range("Y58,Z11"))
Range("AA58") = Application.WorksheetFunction.Sum(Range("Z58,AA11"))
Range("AB58") = Application.WorksheetFunction.Sum(Range("AA58,AB11"))

Range("AC58") = Application.WorksheetFunction.Sum(Range("AB58,AC11"))
Range("AD58") = Application.WorksheetFunction.Sum(Range("AC58,AD11"))
Range("AE58") = Application.WorksheetFunction.Sum(Range("AD58,AE11"))
Range("AF58") = Application.WorksheetFunction.Sum(Range("AE58,AF11"))
Range("AG58") = Application.WorksheetFunction.Sum(Range("AF58,AG11"))

--
Carlee
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      23rd Sep 2007
This should make your formulas a bit more efficiently.

Sub df()
'Range("C58") = Range("C11")
Cells(58, 3) = Cells(11, 3)
For i = 4 To 34
Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
Next
End Sub

Not quite sure about the rest but maybe you can use an IF
sub df1()
Cells(58, 3) = Cells(11, 3)
for i=4 to 34
if cells(i,11)>0 then 'or cells(i,58)
Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
end if
next
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Carlee" <(E-Mail Removed)> wrote in message
news:3C246EA1-BCAE-4CAA-91D6-(E-Mail Removed)...
> Hi all,
>
> I use the code below to produce cummulative totals for a given month (Days
> 1-31)
>
> Issue:
> If i use this code to produce a row of data, for a mid-month report,
> specifically a graph, where i run out of data, the unknown days contain
> the
> last known value.
>
> Question:
> How can tell the code that if there is no value for the date, display a
> '0',
> otherwise, calculate the cummunlative value for the day in question.
>
>
>
> Code:
> Range("C58") = Range("C11")
> Range("D58") = Application.WorksheetFunction.Sum(Range("C58,D11"))
> Range("E58") = Application.WorksheetFunction.Sum(Range("D58,E11"))
> Range("F58") = Application.WorksheetFunction.Sum(Range("E58,F11"))
> Range("G58") = Application.WorksheetFunction.Sum(Range("F58,G11"))
> Range("H58") = Application.WorksheetFunction.Sum(Range("G58,H11"))
>
> Range("I58") = Application.WorksheetFunction.Sum(Range("H58,I11"))
>
> Range("J58") = Application.WorksheetFunction.Sum(Range("I58,J11"))
> Range("K58") = Application.WorksheetFunction.Sum(Range("J58,K11"))
> Range("L58") = Application.WorksheetFunction.Sum(Range("K58,L11"))
> Range("M58") = Application.WorksheetFunction.Sum(Range("L58,M11"))
>
> Range("N58") = Application.WorksheetFunction.Sum(Range("M58,N11"))
> Range("O58") = Application.WorksheetFunction.Sum(Range("N58,O11"))
> Range("P58") = Application.WorksheetFunction.Sum(Range("O58,P11"))
> Range("Q58") = Application.WorksheetFunction.Sum(Range("P58,Q11"))
> Range("R58") = Application.WorksheetFunction.Sum(Range("Q58,R11"))
>
> Range("S58") = Application.WorksheetFunction.Sum(Range("R58,S11"))
> Range("T58") = Application.WorksheetFunction.Sum(Range("S58,T11"))
> Range("U58") = Application.WorksheetFunction.Sum(Range("T58,U11"))
> Range("W58") = Application.WorksheetFunction.Sum(Range("V58,W11"))
>
> Range("X58") = Application.WorksheetFunction.Sum(Range("W58,X11"))
> Range("Y58") = Application.WorksheetFunction.Sum(Range("X58,Y11"))
> Range("Z58") = Application.WorksheetFunction.Sum(Range("Y58,Z11"))
> Range("AA58") =
> Application.WorksheetFunction.Sum(Range("Z58,AA11"))
> Range("AB58") =
> Application.WorksheetFunction.Sum(Range("AA58,AB11"))
>
> Range("AC58") =
> Application.WorksheetFunction.Sum(Range("AB58,AC11"))
> Range("AD58") =
> Application.WorksheetFunction.Sum(Range("AC58,AD11"))
> Range("AE58") =
> Application.WorksheetFunction.Sum(Range("AD58,AE11"))
> Range("AF58") =
> Application.WorksheetFunction.Sum(Range("AE58,AF11"))
> Range("AG58") =
> Application.WorksheetFunction.Sum(Range("AF58,AG11"))
>
> --
> Carlee


 
Reply With Quote
 
=?Utf-8?B?Q2FybGVl?=
Guest
Posts: n/a
 
      24th Sep 2007
Hi there,
i am a bit unsure how to implement this code. How can 'call' this on my
sheet to make it work?
--
Carlee


"Don Guillett" wrote:

> This should make your formulas a bit more efficiently.
>
> Sub df()
> 'Range("C58") = Range("C11")
> Cells(58, 3) = Cells(11, 3)
> For i = 4 To 34
> Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
> Next
> End Sub
>
> Not quite sure about the rest but maybe you can use an IF
> sub df1()
> Cells(58, 3) = Cells(11, 3)
> for i=4 to 34
> if cells(i,11)>0 then 'or cells(i,58)
> Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
> end if
> next
> end sub
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "Carlee" <(E-Mail Removed)> wrote in message
> news:3C246EA1-BCAE-4CAA-91D6-(E-Mail Removed)...
> > Hi all,
> >
> > I use the code below to produce cummulative totals for a given month (Days
> > 1-31)
> >
> > Issue:
> > If i use this code to produce a row of data, for a mid-month report,
> > specifically a graph, where i run out of data, the unknown days contain
> > the
> > last known value.
> >
> > Question:
> > How can tell the code that if there is no value for the date, display a
> > '0',
> > otherwise, calculate the cummunlative value for the day in question.
> >
> >
> >
> > Code:
> > Range("C58") = Range("C11")
> > Range("D58") = Application.WorksheetFunction.Sum(Range("C58,D11"))
> > Range("E58") = Application.WorksheetFunction.Sum(Range("D58,E11"))
> > Range("F58") = Application.WorksheetFunction.Sum(Range("E58,F11"))
> > Range("G58") = Application.WorksheetFunction.Sum(Range("F58,G11"))
> > Range("H58") = Application.WorksheetFunction.Sum(Range("G58,H11"))
> >
> > Range("I58") = Application.WorksheetFunction.Sum(Range("H58,I11"))
> >
> > Range("J58") = Application.WorksheetFunction.Sum(Range("I58,J11"))
> > Range("K58") = Application.WorksheetFunction.Sum(Range("J58,K11"))
> > Range("L58") = Application.WorksheetFunction.Sum(Range("K58,L11"))
> > Range("M58") = Application.WorksheetFunction.Sum(Range("L58,M11"))
> >
> > Range("N58") = Application.WorksheetFunction.Sum(Range("M58,N11"))
> > Range("O58") = Application.WorksheetFunction.Sum(Range("N58,O11"))
> > Range("P58") = Application.WorksheetFunction.Sum(Range("O58,P11"))
> > Range("Q58") = Application.WorksheetFunction.Sum(Range("P58,Q11"))
> > Range("R58") = Application.WorksheetFunction.Sum(Range("Q58,R11"))
> >
> > Range("S58") = Application.WorksheetFunction.Sum(Range("R58,S11"))
> > Range("T58") = Application.WorksheetFunction.Sum(Range("S58,T11"))
> > Range("U58") = Application.WorksheetFunction.Sum(Range("T58,U11"))
> > Range("W58") = Application.WorksheetFunction.Sum(Range("V58,W11"))
> >
> > Range("X58") = Application.WorksheetFunction.Sum(Range("W58,X11"))
> > Range("Y58") = Application.WorksheetFunction.Sum(Range("X58,Y11"))
> > Range("Z58") = Application.WorksheetFunction.Sum(Range("Y58,Z11"))
> > Range("AA58") =
> > Application.WorksheetFunction.Sum(Range("Z58,AA11"))
> > Range("AB58") =
> > Application.WorksheetFunction.Sum(Range("AA58,AB11"))
> >
> > Range("AC58") =
> > Application.WorksheetFunction.Sum(Range("AB58,AC11"))
> > Range("AD58") =
> > Application.WorksheetFunction.Sum(Range("AC58,AD11"))
> > Range("AE58") =
> > Application.WorksheetFunction.Sum(Range("AD58,AE11"))
> > Range("AF58") =
> > Application.WorksheetFunction.Sum(Range("AE58,AF11"))
> > Range("AG58") =
> > Application.WorksheetFunction.Sum(Range("AF58,AG11"))
> >
> > --
> > Carlee

>
>

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      24th Sep 2007
Just try it. If it doesn't do it for you don't save.....
I could probably figure out the rest if I saw your workbook. Send to my
address below, if desired.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Carlee" <(E-Mail Removed)> wrote in message
news:8F474244-ABCD-478B-BEE2-(E-Mail Removed)...
> Hi there,
> i am a bit unsure how to implement this code. How can 'call' this on my
> sheet to make it work?
> --
> Carlee
>
>
> "Don Guillett" wrote:
>
>> This should make your formulas a bit more efficiently.
>>
>> Sub df()
>> 'Range("C58") = Range("C11")
>> Cells(58, 3) = Cells(11, 3)
>> For i = 4 To 34
>> Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
>> Next
>> End Sub
>>
>> Not quite sure about the rest but maybe you can use an IF
>> sub df1()
>> Cells(58, 3) = Cells(11, 3)
>> for i=4 to 34
>> if cells(i,11)>0 then 'or cells(i,58)
>> Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
>> end if
>> next
>> end sub
>> --
>> Don Guillett
>> Microsoft MVP Excel
>> SalesAid Software
>> (E-Mail Removed)
>> "Carlee" <(E-Mail Removed)> wrote in message
>> news:3C246EA1-BCAE-4CAA-91D6-(E-Mail Removed)...
>> > Hi all,
>> >
>> > I use the code below to produce cummulative totals for a given month
>> > (Days
>> > 1-31)
>> >
>> > Issue:
>> > If i use this code to produce a row of data, for a mid-month report,
>> > specifically a graph, where i run out of data, the unknown days contain
>> > the
>> > last known value.
>> >
>> > Question:
>> > How can tell the code that if there is no value for the date, display a
>> > '0',
>> > otherwise, calculate the cummunlative value for the day in question.
>> >
>> >
>> >
>> > Code:
>> > Range("C58") = Range("C11")
>> > Range("D58") =
>> > Application.WorksheetFunction.Sum(Range("C58,D11"))
>> > Range("E58") =
>> > Application.WorksheetFunction.Sum(Range("D58,E11"))
>> > Range("F58") =
>> > Application.WorksheetFunction.Sum(Range("E58,F11"))
>> > Range("G58") =
>> > Application.WorksheetFunction.Sum(Range("F58,G11"))
>> > Range("H58") =
>> > Application.WorksheetFunction.Sum(Range("G58,H11"))
>> >
>> > Range("I58") =
>> > Application.WorksheetFunction.Sum(Range("H58,I11"))
>> >
>> > Range("J58") =
>> > Application.WorksheetFunction.Sum(Range("I58,J11"))
>> > Range("K58") =
>> > Application.WorksheetFunction.Sum(Range("J58,K11"))
>> > Range("L58") =
>> > Application.WorksheetFunction.Sum(Range("K58,L11"))
>> > Range("M58") =
>> > Application.WorksheetFunction.Sum(Range("L58,M11"))
>> >
>> > Range("N58") =
>> > Application.WorksheetFunction.Sum(Range("M58,N11"))
>> > Range("O58") =
>> > Application.WorksheetFunction.Sum(Range("N58,O11"))
>> > Range("P58") =
>> > Application.WorksheetFunction.Sum(Range("O58,P11"))
>> > Range("Q58") =
>> > Application.WorksheetFunction.Sum(Range("P58,Q11"))
>> > Range("R58") =
>> > Application.WorksheetFunction.Sum(Range("Q58,R11"))
>> >
>> > Range("S58") =
>> > Application.WorksheetFunction.Sum(Range("R58,S11"))
>> > Range("T58") =
>> > Application.WorksheetFunction.Sum(Range("S58,T11"))
>> > Range("U58") =
>> > Application.WorksheetFunction.Sum(Range("T58,U11"))
>> > Range("W58") =
>> > Application.WorksheetFunction.Sum(Range("V58,W11"))
>> >
>> > Range("X58") =
>> > Application.WorksheetFunction.Sum(Range("W58,X11"))
>> > Range("Y58") =
>> > Application.WorksheetFunction.Sum(Range("X58,Y11"))
>> > Range("Z58") =
>> > Application.WorksheetFunction.Sum(Range("Y58,Z11"))
>> > Range("AA58") =
>> > Application.WorksheetFunction.Sum(Range("Z58,AA11"))
>> > Range("AB58") =
>> > Application.WorksheetFunction.Sum(Range("AA58,AB11"))
>> >
>> > Range("AC58") =
>> > Application.WorksheetFunction.Sum(Range("AB58,AC11"))
>> > Range("AD58") =
>> > Application.WorksheetFunction.Sum(Range("AC58,AD11"))
>> > Range("AE58") =
>> > Application.WorksheetFunction.Sum(Range("AD58,AE11"))
>> > Range("AF58") =
>> > Application.WorksheetFunction.Sum(Range("AE58,AF11"))
>> > Range("AG58") =
>> > Application.WorksheetFunction.Sum(Range("AF58,AG11"))
>> >
>> > --
>> > Carlee

>>
>>


 
Reply With Quote
 
=?Utf-8?B?Q2FybGVl?=
Guest
Posts: n/a
 
      24th Sep 2007
Hi there,
Well...I tried it, and it worked, however, the numbers were not correct.
I will sent the workbook along
--
Carlee


"Don Guillett" wrote:

> Just try it. If it doesn't do it for you don't save.....
> I could probably figure out the rest if I saw your workbook. Send to my
> address below, if desired.
>
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)
> "Carlee" <(E-Mail Removed)> wrote in message
> news:8F474244-ABCD-478B-BEE2-(E-Mail Removed)...
> > Hi there,
> > i am a bit unsure how to implement this code. How can 'call' this on my
> > sheet to make it work?
> > --
> > Carlee
> >
> >
> > "Don Guillett" wrote:
> >
> >> This should make your formulas a bit more efficiently.
> >>
> >> Sub df()
> >> 'Range("C58") = Range("C11")
> >> Cells(58, 3) = Cells(11, 3)
> >> For i = 4 To 34
> >> Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
> >> Next
> >> End Sub
> >>
> >> Not quite sure about the rest but maybe you can use an IF
> >> sub df1()
> >> Cells(58, 3) = Cells(11, 3)
> >> for i=4 to 34
> >> if cells(i,11)>0 then 'or cells(i,58)
> >> Cells(58, i) = Application.Sum(Range(Cells(58, i), Cells(11, i + 1)))
> >> end if
> >> next
> >> end sub
> >> --
> >> Don Guillett
> >> Microsoft MVP Excel
> >> SalesAid Software
> >> (E-Mail Removed)
> >> "Carlee" <(E-Mail Removed)> wrote in message
> >> news:3C246EA1-BCAE-4CAA-91D6-(E-Mail Removed)...
> >> > Hi all,
> >> >
> >> > I use the code below to produce cummulative totals for a given month
> >> > (Days
> >> > 1-31)
> >> >
> >> > Issue:
> >> > If i use this code to produce a row of data, for a mid-month report,
> >> > specifically a graph, where i run out of data, the unknown days contain
> >> > the
> >> > last known value.
> >> >
> >> > Question:
> >> > How can tell the code that if there is no value for the date, display a
> >> > '0',
> >> > otherwise, calculate the cummunlative value for the day in question.
> >> >
> >> >
> >> >
> >> > Code:
> >> > Range("C58") = Range("C11")
> >> > Range("D58") =
> >> > Application.WorksheetFunction.Sum(Range("C58,D11"))
> >> > Range("E58") =
> >> > Application.WorksheetFunction.Sum(Range("D58,E11"))
> >> > Range("F58") =
> >> > Application.WorksheetFunction.Sum(Range("E58,F11"))
> >> > Range("G58") =
> >> > Application.WorksheetFunction.Sum(Range("F58,G11"))
> >> > Range("H58") =
> >> > Application.WorksheetFunction.Sum(Range("G58,H11"))
> >> >
> >> > Range("I58") =
> >> > Application.WorksheetFunction.Sum(Range("H58,I11"))
> >> >
> >> > Range("J58") =
> >> > Application.WorksheetFunction.Sum(Range("I58,J11"))
> >> > Range("K58") =
> >> > Application.WorksheetFunction.Sum(Range("J58,K11"))
> >> > Range("L58") =
> >> > Application.WorksheetFunction.Sum(Range("K58,L11"))
> >> > Range("M58") =
> >> > Application.WorksheetFunction.Sum(Range("L58,M11"))
> >> >
> >> > Range("N58") =
> >> > Application.WorksheetFunction.Sum(Range("M58,N11"))
> >> > Range("O58") =
> >> > Application.WorksheetFunction.Sum(Range("N58,O11"))
> >> > Range("P58") =
> >> > Application.WorksheetFunction.Sum(Range("O58,P11"))
> >> > Range("Q58") =
> >> > Application.WorksheetFunction.Sum(Range("P58,Q11"))
> >> > Range("R58") =
> >> > Application.WorksheetFunction.Sum(Range("Q58,R11"))
> >> >
> >> > Range("S58") =
> >> > Application.WorksheetFunction.Sum(Range("R58,S11"))
> >> > Range("T58") =
> >> > Application.WorksheetFunction.Sum(Range("S58,T11"))
> >> > Range("U58") =
> >> > Application.WorksheetFunction.Sum(Range("T58,U11"))
> >> > Range("W58") =
> >> > Application.WorksheetFunction.Sum(Range("V58,W11"))
> >> >
> >> > Range("X58") =
> >> > Application.WorksheetFunction.Sum(Range("W58,X11"))
> >> > Range("Y58") =
> >> > Application.WorksheetFunction.Sum(Range("X58,Y11"))
> >> > Range("Z58") =
> >> > Application.WorksheetFunction.Sum(Range("Y58,Z11"))
> >> > Range("AA58") =
> >> > Application.WorksheetFunction.Sum(Range("Z58,AA11"))
> >> > Range("AB58") =
> >> > Application.WorksheetFunction.Sum(Range("AA58,AB11"))
> >> >
> >> > Range("AC58") =
> >> > Application.WorksheetFunction.Sum(Range("AB58,AC11"))
> >> > Range("AD58") =
> >> > Application.WorksheetFunction.Sum(Range("AC58,AD11"))
> >> > Range("AE58") =
> >> > Application.WorksheetFunction.Sum(Range("AD58,AE11"))
> >> > Range("AF58") =
> >> > Application.WorksheetFunction.Sum(Range("AE58,AF11"))
> >> > Range("AG58") =
> >> > Application.WorksheetFunction.Sum(Range("AF58,AG11"))
> >> >
> >> > --
> >> > Carlee
> >>
> >>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with cummulative totals triniqueen Microsoft Excel Misc 3 17th Nov 2008 02:14 AM
Cummulative Alimbilo Microsoft Access Getting Started 3 9th Jun 2008 04:53 PM
Pivot Totals: Group totals different from Grand totals PsyberFox Microsoft Excel Misc 1 13th Feb 2008 06:16 PM
Year to Date Cummulative Totals =?Utf-8?B?Q2FybGVl?= Microsoft Excel Programming 2 10th Oct 2007 12:06 AM
Re: Cummulative totals Bernard Liengme Microsoft Excel Misc 1 13th Feb 2004 07:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 AM.