Find last date running total equalled zero

RandomTandem

New Member
Joined
Jul 10, 2017
Messages
17
If I have a list of dates (in chronological order) in Column A and a list of stock purchases or sales in column B. Is there a formula which will help me find the last date where the running total was equal to zero prior to a date I put in cell C1?

In the below example, If I put 13th Aug in cell C1, it would tell me 12th Aug but if I had 15th Aug in cell C1, it would put 14th Aug

DatePurchase/Sale Amount
10th Aug+5
11th Aug+10
12th Aug-15
13th Aug+80
14th Aug-80
15th Aug10

<tbody>
</tbody>


I would normally use a helper column to achieve this but I cannot do it in this example.

Thank you.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Sorry: one more question

If I have two different brokerage accounts, named A and B, which is detailed in cells D2 to D7, how do I modify the formula to only do the running totals for account A?
 
Upvote 0
I tried to use an AND function in the initial IF statement but it is returning a zero - any help would be greatly appreciated.

=MAX(IF(AND($A$2:$A$7<=C1,$D$2:$D$7="A"),IF(SUBTOTAL(9,OFFSET($B$2,0,0,ROW($B$2:$B$7)-ROW($B$2)+1))=0,$A$2:$A$7)))
 
Upvote 0
I tried to use an AND function in the initial IF statement but it is returning a zero - any help would be greatly appreciated.

=MAX(IF(AND($A$2:$A$7<=C1,$D$2:$D$7="A"),IF(SUBTOTAL(9,OFFSET($B$2,0,0,ROW($B$2:$B$7)-ROW($B$2)+1))=0,$A$2:$A$7)))

AND cannot be called upon in such formula in order to get an array result for AND cannot but deliver a single result.

I think you need to construct an additional range which you can use for farther evaluations... If you want to take this turn, try to post a representative but concise sample.
 
Upvote 0
Imgur: The most awesome images on the Internet
lLtRM4N


AND cannot be called upon in such formula in order to get an array result for AND cannot but deliver a single result.

I think you need to construct an additional range which you can use for farther evaluations... If you want to take this turn, try to post a representative but concise sample.

Thank you...I have uploaded an image to imgur (hopefully it will work)

In the attached picture, columns D and E show a continuous running total, the perfect solution would not have these helper columns.

For Account A, I'd be looking to return 16-Jul-17 for any dates prior to 23-Jul-17, then return 23-Jul-17 for any dates thereafter.

For Account B, I'd be looking to return 0 for any dates prior to 19-Jul-17, then return 19-Jul-17 for any dates between 19-Jul-17 and 23-Jul-17 and then 24-Jul-17 for any date after and including 24-Jul-17.

Many thanks,
 
Upvote 0
Imgur? I'm sorry I have no intention in retyping what an image shows into Excel for experimentation or testing.
 
Upvote 0
Imgur? I'm sorry I have no intention in retyping what an image shows into Excel for experimentation or testing.

OK sorry - I don't know how to paste tables into this forum - I will type it...

AccountDateBuy/SellAccount AAccount B
B16-Jul-172000200
A17-Jul-175050200
A18-Jul-171060200
B19-Jul-17-200600
A20-Jul-17-40200
B21-Jul-17402040
A22-Jul-17507040
A23-Jul-17-70040
B24-Jul-17-4000

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,916
Members
449,093
Latest member
dbomb1414

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