Sum Amount till max value greater than 1

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,362
Office Version
  1. 2010
Hello,

I have an amount in columns "A2" to below down side

I want a formula in cells “B2” Below down which can sum amount till max value greater than 1

For example sun first amount staring from A2:A12 which is 1 to max 512 = 1023 result sum in column B, sum second amount staring from A13:B18 which is 1 to max 32 = 63 result sum in column B….and so on

For a more detail the image is attached. Pease suggest formula

*AB
1AmountSum
211
323
447
5815
61631
73263
864127
9128255
10256511
115121.023
1211
1323
1447
15815
161631
173263
1811
1912
2013
2114
2226
23410
24818
251634
263266
2711
2812
2913
3014
3115
3227
33411
34819
351635
363267
3764131
3811
3912
4013
4114

Thank you all.

I am using Excel 2000

Regards,
Moti
 

Attachments

  • Sum Max Amount.png
    Sum Max Amount.png
    47.2 KB · Views: 2

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Upvote 0
Not sure why but I always go in with code, seems to be the only tool in my toolbox, solved now but code below anyway:
VBA Code:
Sub test()
    Dim rng As Range, var As Variant, x As Long, s As Double, tmp As Double
    
    Set rng = Range("A2:B" & Range("A" & Rows.Count).End(xlUp).Row)
    var = rng.Value
    
    For x = 1 To UBound(var)
        If var(x, 1) < tmp Then
            s = 0
        End If
        s = s + var(x, 1)
        var(x, 2) = s
        tmp = var(x, 1)
    Next x
    rng = var
End Sub
 
Upvote 0
Not sure why but I always go in with code, seems to be the only tool in my toolbox, solved now but code below anyway:
VBA Code:
Sub test()
    Dim rng As Range, var As Variant, x As Long, s As Double, tmp As Double
  
    Set rng = Range("A2:B" & Range("A" & Rows.Count).End(xlUp).Row)
    var = rng.Value
  
    For x = 1 To UBound(var)
        If var(x, 1) < tmp Then
            s = 0
        End If
        s = s + var(x, 1)
        var(x, 2) = s
        tmp = var(x, 1)
    Next x
    rng = var
End Sub
Georgiboy, macro worked fine! but I will go with formula because it is practical for small job for which I need at the movement.

Any ways thank you for your help some day may I need for Large file to work with it.

Good Luck and have a good day!

Kind Regards,
Moti :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top