Sum Largest Negative and Positive Question

MXL

Board Regular
Joined
Jun 15, 2010
Messages
67
hello,

I have a table I would like to sum the largest negative sums and also the largest positive sums within a column, the table will illustrate below;

[TABLE="class: grid, width: 100"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]B[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]=a1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]=a1+a2[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]-2[/TD]
[TD="align: center"]=a2+a3[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]-3[/TD]
[TD="align: center"]=a3+a4[/TD]
[TD="align: center"]-1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]=a4+a5[/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]-3[/TD]
[TD="align: center"]=a5+a6[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Largest Positive Sum[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Largest Negative Sum[/TD]
[TD="align: center"]
-1
[/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]

you can see in column A, the largest positive sum was in cell B5 with the sum of 6, the largest negative sum was in cell B4 with the negative sum of -1 Is there a formula I can input in cell B7 and B8 that will give me the largest positive and largest negative sums?

thank you for taking the time to read this and look forward to hearing from you all.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
The largest positive sum would be...

=MAX(B1:B6)

and the largest negative sum would be...

=MIN(B1:B6)
 
Upvote 0
hello Rick,

thank you for your response much appreciated, would you be able to apply that formula without the helper column B1:B6? formula that can sum the largest running positive and negative sums in column A1:A6? i prefer not to have the helper column B1:B6. thank you and look forward to hearing from you.
 
Upvote 0
In your example wouldn't the largest possible sum be 4 since 7 + (-3) = 4

and also the largest negative sum be -5 since (-2) + (-3) = -5 ?

if so try:

=MAX(A1, A1:A5+A2:A6)

and

=MIN(A1, A1:A5+A2:A6)

both entered as arrays with ctrl + shift + enter
 
Upvote 0
hi finalfight40,

the aim is to try and sum the largest running sum total and negative sum starting at cell a1 in column A, so if you start start summing from cell A1 and go down to cell A2, A3, A4, A5, and finally A6, you will notice that the largest positive sum during that sequence was 6, and the time that the sum was at its lowest from cell A1 and go down to cell A2, A3, A4, A5, and finally A6 the sum was -1, so i am trying to find a formula that can give me the largest positive sum starting from cell A1 and the smallest sum starting from cell A1 at in column A. Basically, trying to find at what point was the sum the largest and smallest when summing from A1 down to A6.

thank you and look forward to hearing from you.
 
Upvote 0
Try:

=MAX(SUBTOTAL(9,OFFSET(A1,0,0,ROW(A1:A6)-ROW(A1)+1)))

and

=MIN(SUBTOTAL(9,OFFSET(A1,0,0,ROW(A1:A6)-ROW(A1)+1)))

both confirmed with Control+Shift+Enter.

These find the max and min sums of A1, A1+A2, A1+A2+A3, A1+A2+A3+A4, A1+A2+A3+A4+A5, A1+A2+A3+A4+A5+A6. If you want to include other possible sums, like A3+A4+A5, that's much trickier.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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