Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default loop and sum

Jenna,

Put this formula into cell D2, and copy down to match your column C:

=IF(SUM($C$1:C2)-SUM($D$1:D1) 3500,SUM($C$1:C2)-SUM($D$1:D1),"")

Otherwise, you could use this macro:

Sub SumC()
Dim myC As Range
Dim mySum As Double
mySum = 0
For Each myC In Intersect(Range("C2:C65536"), _
ActiveSheet.UsedRange)
mySum = mySum + myC.Value
If mySum 3500 Then
myC(1, 2).Value = mySum
mySum = 0
End If
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

Please help

i need a procedure to loop down column c and the first row where the sum is
greater than 3500 put that amount in the adjacent column, then repeat from
the next row down.

thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default loop and sum

Jenna,

Your summed range at the end:

SUM($C$1:C2)

is wrong. It should be column D:

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($D$1:D2),"")

HTH,
Bernie
MS Excel MVP



"jenna" wrote in message
...
Hii

I would prefer the formula but i'think its a dead end

here's my formula

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($C$1:C2),"")
the problem is after the IF is true i want the formula to start from the
nest row

is possible let me know.

thanks

"Bernie Deitrick" wrote:

Jenna,

Put this formula into cell D2, and copy down to match your column C:

=IF(SUM($C$1:C2)-SUM($D$1:D1) 3500,SUM($C$1:C2)-SUM($D$1:D1),"")

Otherwise, you could use this macro:

Sub SumC()
Dim myC As Range
Dim mySum As Double
mySum = 0
For Each myC In Intersect(Range("C2:C65536"), _
ActiveSheet.UsedRange)
mySum = mySum + myC.Value
If mySum 3500 Then
myC(1, 2).Value = mySum
mySum = 0
End If
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

Please help

i need a procedure to loop down column c and the first row where the
sum is
greater than 3500 put that amount in the adjacent column, then repeat
from
the next row down.

thanks






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default loop and sum


bernie

The only problem is have with the formula is after the test is true i want
that value in column D instead of the total


thanks so far
"Bernie Deitrick" wrote:

Jenna,

Your summed range at the end:

SUM($C$1:C2)

is wrong. It should be column D:

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($D$1:D2),"")

HTH,
Bernie
MS Excel MVP



"jenna" wrote in message
...
Hii

I would prefer the formula but i'think its a dead end

here's my formula

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($C$1:C2),"")
the problem is after the IF is true i want the formula to start from the
nest row

is possible let me know.

thanks

"Bernie Deitrick" wrote:

Jenna,

Put this formula into cell D2, and copy down to match your column C:

=IF(SUM($C$1:C2)-SUM($D$1:D1) 3500,SUM($C$1:C2)-SUM($D$1:D1),"")

Otherwise, you could use this macro:

Sub SumC()
Dim myC As Range
Dim mySum As Double
mySum = 0
For Each myC In Intersect(Range("C2:C65536"), _
ActiveSheet.UsedRange)
mySum = mySum + myC.Value
If mySum 3500 Then
myC(1, 2).Value = mySum
mySum = 0
End If
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

Please help

i need a procedure to loop down column c and the first row where the
sum is
greater than 3500 put that amount in the adjacent column, then repeat
from
the next row down.

thanks






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default loop and sum

Jenna,

So, if you have a column filled with just the number 101, so that by row 36 (the 35th value) you
have 3,535. What do you want in column D? 101, or 3,500, or 3,535, or 35? And do you want to
start your sum over with 0, or with the amount that the sum was over 3,500? And what if the sum is
exactly 3,500?

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

bernie

The only problem is have with the formula is after the test is true i want
that value in column D instead of the total


thanks so far
"Bernie Deitrick" wrote:

Jenna,

Your summed range at the end:

SUM($C$1:C2)

is wrong. It should be column D:

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($D$1:D2),"")

HTH,
Bernie
MS Excel MVP



"jenna" wrote in message
...
Hii

I would prefer the formula but i'think its a dead end

here's my formula

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($C$1:C2),"")
the problem is after the IF is true i want the formula to start from the
nest row

is possible let me know.

thanks

"Bernie Deitrick" wrote:

Jenna,

Put this formula into cell D2, and copy down to match your column C:

=IF(SUM($C$1:C2)-SUM($D$1:D1) 3500,SUM($C$1:C2)-SUM($D$1:D1),"")

Otherwise, you could use this macro:

Sub SumC()
Dim myC As Range
Dim mySum As Double
mySum = 0
For Each myC In Intersect(Range("C2:C65536"), _
ActiveSheet.UsedRange)
mySum = mySum + myC.Value
If mySum 3500 Then
myC(1, 2).Value = mySum
mySum = 0
End If
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

Please help

i need a procedure to loop down column c and the first row where the
sum is
greater than 3500 put that amount in the adjacent column, then repeat
from
the next row down.

thanks








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default loop and sum

Hii Bernie

I want 101 in column D and start at 0

Thanks you so much

"Bernie Deitrick" wrote:

Jenna,

So, if you have a column filled with just the number 101, so that by row 36 (the 35th value) you
have 3,535. What do you want in column D? 101, or 3,500, or 3,535, or 35? And do you want to
start your sum over with 0, or with the amount that the sum was over 3,500? And what if the sum is
exactly 3,500?

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

bernie

The only problem is have with the formula is after the test is true i want
that value in column D instead of the total


thanks so far
"Bernie Deitrick" wrote:

Jenna,

Your summed range at the end:

SUM($C$1:C2)

is wrong. It should be column D:

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($D$1:D2),"")

HTH,
Bernie
MS Excel MVP



"jenna" wrote in message
...
Hii

I would prefer the formula but i'think its a dead end

here's my formula

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($C$1:C2),"")
the problem is after the IF is true i want the formula to start from the
nest row

is possible let me know.

thanks

"Bernie Deitrick" wrote:

Jenna,

Put this formula into cell D2, and copy down to match your column C:

=IF(SUM($C$1:C2)-SUM($D$1:D1) 3500,SUM($C$1:C2)-SUM($D$1:D1),"")

Otherwise, you could use this macro:

Sub SumC()
Dim myC As Range
Dim mySum As Double
mySum = 0
For Each myC In Intersect(Range("C2:C65536"), _
ActiveSheet.UsedRange)
mySum = mySum + myC.Value
If mySum 3500 Then
myC(1, 2).Value = mySum
mySum = 0
End If
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

Please help

i need a procedure to loop down column c and the first row where the
sum is
greater than 3500 put that amount in the adjacent column, then repeat
from
the next row down.

thanks











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default loop and sum

Jenna,

The easiest thing would be to use column E, with a formula like this
(written for E3):

=IF(D3<"",C3,"")

Copy down to match the formulas in column D, then hide column D.

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...
Hii Bernie

I want 101 in column D and start at 0

Thanks you so much

"Bernie Deitrick" wrote:

Jenna,

So, if you have a column filled with just the number 101, so that by row
36 (the 35th value) you
have 3,535. What do you want in column D? 101, or 3,500, or 3,535, or
35? And do you want to
start your sum over with 0, or with the amount that the sum was over
3,500? And what if the sum is
exactly 3,500?

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

bernie

The only problem is have with the formula is after the test is true i
want
that value in column D instead of the total


thanks so far
"Bernie Deitrick" wrote:

Jenna,

Your summed range at the end:

SUM($C$1:C2)

is wrong. It should be column D:

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($D$1:D2),"")

HTH,
Bernie
MS Excel MVP



"jenna" wrote in message
...
Hii

I would prefer the formula but i'think its a dead end

here's my formula

=IF(SUM($C$1:C3)-SUM($D$1:D2) 3500,SUM($C$1:C3)-SUM($C$1:C2),"")
the problem is after the IF is true i want the formula to start from
the
nest row

is possible let me know.

thanks

"Bernie Deitrick" wrote:

Jenna,

Put this formula into cell D2, and copy down to match your column
C:

=IF(SUM($C$1:C2)-SUM($D$1:D1) 3500,SUM($C$1:C2)-SUM($D$1:D1),"")

Otherwise, you could use this macro:

Sub SumC()
Dim myC As Range
Dim mySum As Double
mySum = 0
For Each myC In Intersect(Range("C2:C65536"), _
ActiveSheet.UsedRange)
mySum = mySum + myC.Value
If mySum 3500 Then
myC(1, 2).Value = mySum
mySum = 0
End If
Next myC
End Sub

HTH,
Bernie
MS Excel MVP


"jenna" wrote in message
...

Please help

i need a procedure to loop down column c and the first row where
the
sum is
greater than 3500 put that amount in the adjacent column, then
repeat
from
the next row down.

thanks











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default loop and sum

thanks bernie
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
For Each ... Next loop - need to reference the loop variable [email protected] Excel Programming 4 July 13th 06 06:12 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Loop Function unable to loop Junior728 Excel Programming 1 July 28th 05 10:23 AM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM
HELP!!!! Can't stop a loop (NOT an infinite loop) TBA[_2_] Excel Programming 3 December 14th 03 03:33 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"