Sum a column until a specific number is reached

DocDeb

New Member
Joined
Jan 15, 2008
Messages
31
Office Version
  1. 365
Platform
  1. Windows
I would like to Sum a column until 50 is reached. Continue summing the same column again with the remainder from the previous cell if over 50 until 50 is reached again and keep going.
In an adjacent column insert consecutive numbers for each sum of 50.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
It's a pitty you've not shown sample, because i think your description could be one of 2 options. Let's try them both.
Assuming your data starts in cell A2 (A1 holds header) you may use:
Excel Formula:
=A2+IF(B1>=50,MOD(B1,50),B1)
or
Excel Formula:
=MOD(SUM(A$2:A7)-1,50)+1
depending whether sum just after reaching 50 shall be shown as fifty-something or just as this what is above 50

Or may be you are asking about some other possibility?
 

Attachments

  • Zrzut ekranu 2024-09-03 182016.png
    Zrzut ekranu 2024-09-03 182016.png
    29.9 KB · Views: 9
Upvote 1
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also can you post some sample data along with expected results, as it's not clear what you want.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 1
It's a pitty you've not shown sample, because i think your description could be one of 2 options. Let's try them both.
Assuming your data starts in cell A2 (A1 holds header) you may use:
Excel Formula:
=A2+IF(B1>=50,MOD(B1,50),B1)
or
Excel Formula:
=MOD(SUM(A$2:A7)-1,50)+1
depending whether sum just after reaching 50 shall be shown as fifty-something or just as this what is above 50

Or may be you are asking about some other possibility?
That's what I needed! Thank you!
 
Upvote 0
Sorry, I do have a question: Both solutions work great, except =MOD(SUM(A$2:A7)-1,50)+1. If the number in the first column is not a whole number, =MOD(SUM(A$2:A7)-1,50)+1 shows the fraction plus 50.
How can I fix this?
Example:
=A2+IF(B1>=50,MOD(B1,50),B1)
=MOD(SUM(A$2:A7)-1,50)+1
0.020.0250.02
44.024.02
610.0210.02
2030.0230.02
 
Upvote 0
And I now find if the first number in A2 is over 100, '=MOD(SUM(A$2:A7)-1,50)+1' only shows the remainder of 50. :(
Can this be fixed?
Example 1
=A2+IF(B1>=50,MOD(B1,50),B1)
=MOD(SUM(A$2:A7)-1,50)+1​
999949
Example 2
=A2+IF(B1>=50,MOD(B1,50),B1)
=MOD(SUM(A$2:A7)-1,50)+1​
10010050
Example 3
=A2+IF(B1>=50,MOD(B1,50),B1)
=MOD(SUM(A$2:A7)-1,50)+1​
1011011
 
Upvote 0
Maybe I've misunderstood or being too simplistic here, but isn't the answer just
Excel Formula:
=MOD(SUM(A$2:A2),50)

Book1
AB
1
211
345
4611
52233
61144
76.020.02
833.02
958.02
101119.02
119918.02
121331.02
13637.02
14542.02
152315.02
Sheet1
Cell Formulas
RangeFormula
B2:B15B2=MOD(SUM(A$2:A2),50)


Can you explain what you mean by
In an adjacent column insert consecutive numbers for each sum of 50.
 
Upvote 0
Once again:

Show sample. Both sample input data and expected results. Include such details as decimal parts (and how many digits in decimal part are expected in real values), large values (larger than single summation limit), zeros, negative numbers, non-numerical values, etc,

Whichever can be present in real data.

Otherwise we can misunderstand your needs. for instance @

myall_blues

used a simpler version of formula proposed by me, which would result in 0 in case of sum being equal 50, while my proposition =MOD(SUM(A$2:A7)-1,50)+1 would result in 50 in such case. but the side effect is that for numbers with decimal parts yoy end up with 50.02.
 
Upvote 0
@Kaper agreed that example data is required, but the problem of showing 50 instead of zero can be solved as
Excel Formula:
=LET(x, MOD(SUM(A$2:A2),50),IF(x=0,50,x))
 
Upvote 1
but that anyway does not address the issue raised in post #6 with values like more than 50 or may be even 2137 or so ;)
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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