Excel (no VBA) Max Drawdown Formula between Two Dates

tjkramer

New Member
Joined
Aug 11, 2018
Messages
16
Office Version
  1. 2013
Platform
  1. Windows
I have two columns - "A" is a list of daily dates for 10 years; "B" is a list of corresponding prices for 10 years. I'd like to be able to create a "Start Date" cell and an "End Date" cell so that I can change the Start/End Dates to specific, different periods and get the max drawdown for that period (not the max 1-day drawdown, but the maximum price drop representing the biggest equity drawdown during that period). I need to be able to change the dates to get max drawdowns for different quarters, different years and different "shock" events (COVID, rate hikes, et. al.).

Many thanks in advance for the patience and help from the MrExcel community.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi there,

How do you get the max drawdown of any specific period?
Do you use a unique formula for the whole range of values of cells in column B?, or do you use another column to perform day to day partial calculations first?, or maybe you have a sub or udf that calculates the max drawdown from given values obtained from each row?
 
Upvote 0
I'm not "column constrained" on my sheet, so I can add as many columns if needed for sub-calculations. But I've been using the formula in column "C" of =MIN(PriceAtDate2:$PriceAtDate$End)/PriceAtDate1-1. The "MIN" function covers all the dates in the range I need and is pinned ($$) at the end date of the range, so that when I drag the formula down the number of days in the MIN selection decreases. I then have to do another "Min" in a separate cell to get the lowest number from column C, and I'm calling this my Max Drawdown for the period.
So I'm guessing I need some sort of Index/Match to read the Start/Stop dates inside the first MIN formula but I haven't been able to get that to work. I'm also not sure if I have the right Max Drawdown Between Periods calculation - there could be sub-drawdowns or drawdowns across periods that I'm not properly capturing.

I do appreciate your patience and quick response - many thanks!
 
Upvote 0
2013 32-bit

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’)
 
Upvote 0
This was mostly for my amusement - I got it working for 365. I show it below. It hurts my brain just thinking about converting to 2013 - maybe someone here is more ambitious.

MrExcelPlayground13.xlsx
ABCDE
1DatePrice
27/6/200910000Start1/1/2015
37/7/200910116End12/31/2015
47/8/20099965
57/9/200998755/4/201515534
67/10/200999395/28/201514033
77/11/20099864Max Drop1501
87/12/20099963
97/13/200910147
107/14/20099948
117/15/200910094
127/16/200910154
137/17/200910313
147/18/200910260
157/19/200910288
167/20/200910310
177/21/200910253
187/22/200910185
197/23/200910168
207/24/200910054
217/25/200910055
227/26/200910229
237/27/200910033
247/28/200910055
257/29/200910080
267/30/200910064
277/31/200910177
288/1/200910375
Sheet9
Cell Formulas
RangeFormula
D5:E7D5=LET(d,FILTER(A2:B3654,(A2:A3654>=E2)*(A2:A3654<=E3)), rr,ROWS(d), s,SEQUENCE(rr), ss,SEQUENCE(1,rr), aa,MOD(-1+SEQUENCE(rr,rr),rr)+s-1, ab,IF(aa<rr,1+aa,""), ac,IFERROR(INDEX(d,s,2)-INDEX(d,ab,2),0), m,MAX(ac), st,SUM(--(ac=m)*s), fn,st+SUM(--(ac=m)*ss)-1, hd,INDEX(d,st,1), hdx,INDEX(d,st,2), ld,INDEX(d,fn,1), ldx,INDEX(d,fn,2), CHOOSE(SEQUENCE(3,2),hd,hdx,ld,ldx,"Max Drop",m))
Dynamic array formulas.
 
Upvote 0
The first problem is identifying the datas that belong to a certain interval of dates...

Your dates are in column A and the data to process in column B
Use E1 to set the "Starting date" and F1 for the "Ending date"
In E2 and F2 use the following formulas
Excel Formula:
=IF(E1=0,MIN(A:A),E1)
Excel Formula:
=IF(F1=0,MAX(A:A),F1)
These are the "modified starting & endig dates"

Now create a "named range":
-call it SLOT
-in the "refers to box" insert the formula
Excel Formula:
=OFFSET(Sheet1!$A$1,MATCH(Sheet1!$E$2,Sheet1!$A$1:$A$10000)-1,1,1+MATCH(Sheet1!$F$2,Sheet1!$A$1:$A$10000)-MATCH(Sheet1!$E$2,Sheet1!$A$1:$A$10000),1)

This assumes that we are working on Sheet1 with a max of 10k dates; adapt the formula for a different sheet name and a possible longer list of dates, but strictly respect the syntax I used

At this point the range SLOT will refer to column B of the range of dates visible in E2-F2, that reflect the dates set in E1-F1, if they have been set

The result is shown in the green area of the attached XL2BB minishet

At this point if you use (for example) =MIN(SLOT) you will calculate the MIN of the "selected" range; in other words you may use SLOT in your formula to calculate what you need referred to the dates set in E1-F1

BR1 Sales_Ledger RECON(9.2.3) ott-2022.xlsm
ABCDEFGHI
1DatesValues05-feb10-giu
201-gen105-feb10-giuSlot Values
304-gen24
420-gen35
525-gen46
608-feb57
712-feb68
804-mar79
915-mar810
1001-apr911
1115-apr1012
1228-apr1113
1312-mag1214
1419-mag1315
1527-mag14
1630-mag15
1716-giu16
1820-giu17
1928-giu18
2014-lug19
2115-lug20
2223-lug21
2325-lug22
2431-lug23
Sheet1
Cell Formulas
RangeFormula
E2E2=IF(E1=0,MIN(A:A),E1)
F2F2=IF(F1=0,MAX(A:A),F1)
H3:H14H3=SLOT
Dynamic array formulas.
 
Upvote 0
Solution
The first problem is identifying the datas that belong to a certain interval of dates...

Your dates are in column A and the data to process in column B
Use E1 to set the "Starting date" and F1 for the "Ending date"
In E2 and F2 use the following formulas
Excel Formula:
=IF(E1=0,MIN(A:A),E1)
Excel Formula:
=IF(F1=0,MAX(A:A),F1)
These are the "modified starting & endig dates"

Now create a "named range":
-call it SLOT
-in the "refers to box" insert the formula
Excel Formula:
=OFFSET(Sheet1!$A$1,MATCH(Sheet1!$E$2,Sheet1!$A$1:$A$10000)-1,1,1+MATCH(Sheet1!$F$2,Sheet1!$A$1:$A$10000)-MATCH(Sheet1!$E$2,Sheet1!$A$1:$A$10000),1)

This assumes that we are working on Sheet1 with a max of 10k dates; adapt the formula for a different sheet name and a possible longer list of dates, but strictly respect the syntax I used

At this point the range SLOT will refer to column B of the range of dates visible in E2-F2, that reflect the dates set in E1-F1, if they have been set

The result is shown in the green area of the attached XL2BB minishet

At this point if you use (for example) =MIN(SLOT) you will calculate the MIN of the "selected" range; in other words you may use SLOT in your formula to calculate what you need referred to the dates set in E1-F1

BR1 Sales_Ledger RECON(9.2.3) ott-2022.xlsm
ABCDEFGHI
1DatesValues05-feb10-giu
201-gen105-feb10-giuSlot Values
304-gen24
420-gen35
525-gen46
608-feb57
712-feb68
804-mar79
915-mar810
1001-apr911
1115-apr1012
1228-apr1113
1312-mag1214
1419-mag1315
1527-mag14
1630-mag15
1716-giu16
1820-giu17
1928-giu18
2014-lug19
2115-lug20
2223-lug21
2325-lug22
2431-lug23
Sheet1
Cell Formulas
RangeFormula
E2E2=IF(E1=0,MIN(A:A),E1)
F2F2=IF(F1=0,MAX(A:A),F1)
H3:H14H3=SLOT
Dynamic array formulas.
 
Upvote 0
This is great, thanks!
Much appreciated to everyone for the help and patience.
Exactly what I was looking for.

Sincere gratitude for the help!
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,042
Members
449,063
Latest member
ak94

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