Conditional Running Total

ghrain22

Active Member
Joined
Jan 9, 2014
Messages
473
Hello,

I am trying to figure out a formula that will give the the running total sum of a list of data for descending dates, but stop once the running total (of 'X') hits a certain number (say 100).

Input(Dates in M/D/YY):
IDDateXY
a4/1/16502
a3/1/16324
a2/1/16376
a1/1/16258
b4/1/16172
b3/1/16884
b2/1/16526
b1/1/16178

<tbody>
</tbody>

In this example, a would return the sum of 50+32+37=119 (the first instance of the running total being greater than 100) and the corresponding running total of y which was 2+4+6=12

output:
IDXY
a11912
b1056

<tbody>
</tbody>

I've tried complex array formulas and a variety of lookups, but can't seem to crack this one. Any help would be greatly appreciated.

Thanks!
~Ghrain22
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Single cell formulas that pick a value out of various subtotals are notoriously difficult. There are a few techniques, but I couldn't come up with anything that works for your situation. One thing you could do is use a helper column:

ABCDE
1IDDateXY
2a4/1/201650250
3a3/1/201632482
4a2/1/2016376119
5a1/1/2016258144
6b4/1/201617217
7b3/1/2016884105
8b2/1/2016526157
9b1/1/2016178174
10
11IDXYCutoff
12a11912100
13b1056100

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet9

Worksheet Formulas
CellFormula
E2=IF(A2<>A1,C2,E1+C2)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
B12{=MIN(IF((A$2:A$9=A12)*(E$2:E$9>D12),E$2:E$9))}
C12{=SUM(IF(($A$2:$A$9=A12)*($E$2:$E$9<=B12),$D$2:$D$9))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



Put the formula in E2 and copy down the column. Then put the B12 and C12 formulas in with Control+Shift+Enter, then copy down the columns. This should work, but it assumes that all the names are grouped.

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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