+ Reply to Thread
Results 1 to 19 of 19

How to Calculate Maximum Drawdown

  1. #1
    Registered User
    Join Date
    07-18-2015
    Location
    USA
    MS-Off Ver
    ALL
    Posts
    3

    Question How to Calculate Maximum Drawdown

    Lets says that below are my monthly incomes and spendings.
    I want to figure out what is the number when I am most negative and most positive during the month. Using excel of course.

    Data:
    +$120
    -$90
    +$20
    +$100
    -$80
    -$60
    -$60
    +$110
    SUM: +$10

    Explanation by hand.
    If you were to sum these up by hand, at the end of the month, I would be +$10 , but during that month, I would have been -$50 and +$150 as my most negative and most positive holdings respectively.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to Calculate Maximum Drawdown

    Hi, welcome to the forum

    Try this...
    A
    B
    C
    2
    $120 Lowest
    -90
    3
    ($90) Highest
    120
    4
    $20
    5
    $100
    6
    ($80)
    7
    ($60)
    8
    ($60)
    9
    $110

    C2=SMALL($A$2:$A$9,1)
    C3=LARGE($A$2:$A$9,1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to Calculate Maximum Drawdown

    I think you'll need to use a helper column.

    Data Range
    A
    B
    C
    D
    E
    1
    Max
    Min
    2
    $120
    $120
    $150
    ($50)
    3
    ($90)
    $30
    4
    $20
    $50
    5
    $100
    $150
    6
    ($80)
    $70
    7
    ($60)
    $10
    8
    ($60)
    ($50)
    9
    $110
    $60
    10
    ------
    ------
    ------
    ------
    ------


    This formula entered in B2:

    =A2

    This formula entered in B3 and copied down:

    =B2+A3

    Then, for the max and min...

    This formula entered in D2:

    =MAX(B2:B9)

    This formula entered in E2:

    =MIN(B2:B9)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: How to Calculate Maximum Drawdown

    If you do not want helper columns try this

    =MAX(MMULT(N(TRANSPOSE(ROW(A2:A9))<=ROW(A2:A9)),A2:A9))
    and
    =MIN(MMULT(N(TRANSPOSE(ROW(A2:A9))<=ROW(A2:A9)),A2:A9))

    Both array entered i.e. confirmed with Ctrl+Shift+Enter and not just Enter
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to Calculate Maximum Drawdown

    Nice formulas!

    Good job!

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to Calculate Maximum Drawdown

    Nice formulae Ace_XL!!

    MMULT is a real brain buster for me but this is something else! I've manually constructed the virtual range that you created with "N(TRANSPOSE(ROW(A2:A9))<=ROW(A2:A9)) but can't get the formula to work using the values produced.

    Is there a way to lay this out to get the logic straightened out in my mind?
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: How to Calculate Maximum Drawdown

    Hey Ron,

    I'm not the best at explaining and Sucuri makes an appearance every time I'm trying to post on the forum. But here goes..

    The idea is to get a matrix multiplication (MMULT) going.

    The matrix of 64 (8 sets of 8 each, since range of data is 8 rows) will start with a single 1 and seven 0s, two 1s and six 0s, three 1s and 5 0s, four 1s and four 0s ....upto all eights 1s. Each of these eight sets will now get multiplied by the respective values in A2:A9 and summed, essentially a SUMPRODUCT(), thereby giving you a result of 8 summed up values. The increasing number of 1s in each set means that the next value in A2:A9 is added to the respective SUMPRODUCT calculation, thereby giving you a cumulative total of the 'x' number of entries depending upon which set you are looking at i.e. 5 values summed in the 5th set, 6 in the 6th and so on..

    To create this matrix, the TRANSPOSE(ROW(A2:A9))<=ROW(A2:A9)) comes into picture. The N() simply converts this to 1s or 0s depending upon TRUE or FALSE.

    Once you have the calculated array of 8, a MIN/MAX function will give you desired results.

    Hope I've explained this well enough. A simpler way of seeing the formula in action is to reduce the range to say only 4 or 5 cells and jump into evaluate formula.

    Trust this helps

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to Calculate Maximum Drawdown

    Looks like I totally missunderstood that 1

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to Calculate Maximum Drawdown

    Thank you Ace_XL. That is an excellent explanation. I am going to save that and play around with it.

    Thank you very much.

    Ron W.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to Calculate Maximum Drawdown

    @ Ace_XL

    Here is the proof that your explanation was right on because even I could do something with it

    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    29
    To make array C30:J37
    30
    $120
    1
    0
    0
    0
    0
    0
    0
    0
    =N(TRANSPOSE(ROW(B2:B9))<=ROW(B2:B9))
    31
    -$90
    1
    1
    0
    0
    0
    0
    0
    0
    32
    $20
    1
    1
    1
    0
    0
    0
    0
    0
    33
    $100
    1
    1
    1
    1
    0
    0
    0
    0
    =MAX(MMULT(C30:J37,A30:A37))
    34
    -$80
    1
    1
    1
    1
    1
    0
    0
    0
    150
    35
    -$60
    1
    1
    1
    1
    1
    1
    0
    0
    36
    -$60
    1
    1
    1
    1
    1
    1
    1
    0
    =MIN(MMULT(C30:J37,A30:A37))
    37
    $110
    1
    1
    1
    1
    1
    1
    1
    1
    -50

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to Calculate Maximum Drawdown

    Another alternative, but volatile:

    Row\Col
    A
    B
    C
    1
    $120
    -50
    B1: {=MIN(SUBTOTAL(9, OFFSET(A1, 0, 0, ROW(A1:A8)-ROW(A1)+1)))}
    2
    ($90)
    150
    B2: {=MAX(SUBTOTAL(9, OFFSET(A1, 0, 0, ROW(A1:A8)-ROW(A1)+1)))}
    3
    $20
    4
    $100
    5
    ($80)
    6
    ($60)
    7
    ($60)
    8
    $110
    Entia non sunt multiplicanda sine necessitate

  12. #12
    Registered User
    Join Date
    07-18-2015
    Location
    USA
    MS-Off Ver
    ALL
    Posts
    3

    Re: How to Calculate Maximum Drawdown

    That is amazing! Thanks guys. BUT, I have another question.

    Let's say I want to do the exact same thing as before, however, during the summation process, we will only consider the values with an Y in an adjacent cell, and ignore the ones with N.

    For example:
    +$120 Y
    -$90 Y
    +$20 N
    +$100 Y
    -$80 Y
    -$60 N
    -$60 Y
    +$110 Y

    By only summing up the values with a Y, we have a total of $100. I would have been at a maximum position with $130, and the minimum would have been -$10. How would I add this filter to what you guys came up with before?

    With or without helper columns. Doesnt matter to me. I do like the helper column because it also shows me visually for how long I will stay in negative or positive money. Therefore, how do I sum with a previous cell only if there is a Y next to the value?
    Last edited by shaun123; 07-19-2015 at 08:37 PM.

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to Calculate Maximum Drawdown

    Enter the N and Ys in column c and enter this formula in D2 and fill down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    then for MAX
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    then for MIN
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    B
    C
    D
    E
    F
    G
    2
    $120
    y
    120
    Max
    130
    3
    -$90
    y
    30
    Min
    -10
    4
    $20
    n
    30
    5
    $100
    y
    130
    6
    -$80
    y
    50
    7
    -$60
    n
    50
    8
    -$60
    y
    -10
    9
    $110
    y
    100


    Where N is present, the value above it is repeated

  14. #14
    Registered User
    Join Date
    07-18-2015
    Location
    USA
    MS-Off Ver
    ALL
    Posts
    3

    Re: How to Calculate Maximum Drawdown

    Exactly what I needed! thanks a ton

  15. #15
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How to Calculate Maximum Drawdown

    You're welcome.

    Maybe Ace_XL will have a solution using MMULT. Like the other formula that he provided.

  16. #16
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: How to Calculate Maximum Drawdown

    With the MMULT, simply add in a (C2:C9="Y") at the end

    =MIN(MMULT(N(TRANSPOSE(ROW(B2:B9))<=ROW(B2:B9)),B2:B9*(C2:C9="Y")))
    and
    =MAX(MMULT(N(TRANSPOSE(ROW(B2:B9))<=ROW(B2:B9)),B2:B9*(C2:C9="Y")))

    Array entered

  17. #17
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to Calculate Maximum Drawdown

    With this data the MIN formula returns 0 when it should return 7.

    Data Range
    B
    C
    D
    E
    1
    Min
    Max
    2
    -5
    N
    0
    10
    3
    7
    Y
    4
    -5
    N
    5
    3
    Y
    6
    10
    N
    7
    9
    N
    8
    -1
    Y
    9
    1
    Y
    10
    ------
    ------
    ------
    ------

  18. #18
    Registered User
    Join Date
    06-27-2022
    Location
    Cyprus
    MS-Off Ver
    365
    Posts
    1

    Re: How to Calculate Maximum Drawdown

    You did a good and an efficient job here....but what if, instead of net values in column A we had (say) the prices of a stock/currency (eg daily close)? I hope I could do this without the helper column as here (which refers to the net difference up or down every day)....

  19. #19
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to Calculate Maximum Drawdown

    Quote Originally Posted by pimichel View Post
    You did a good and an efficient job here....but what if, instead of net values in column A we had (say) the prices of a stock/currency (eg daily close)? I hope I could do this without the helper column as here (which refers to the net difference up or down every day)....
    If you are asking a question, please start your own thread. We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Drawdown- calculate size and length of multiple drawdown phases (non-VBA)
    By chipps24 in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 04-01-2024, 09:06 AM
  2. [SOLVED] Calculate maximum drawdown with negative numbers
    By billj in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2013, 10:28 AM
  3. Help with Maximum Drawdown
    By nickmangan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-27-2012, 11:19 AM
  4. [SOLVED] Maximum drawdown for the period
    By Salomey in forum Excel General
    Replies: 6
    Last Post: 08-29-2012, 06:56 AM
  5. Replies: 1
    Last Post: 07-06-2012, 02:04 AM
  6. [SOLVED] Maximum Drawdown in Excel
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-07-2005, 01:00 PM
  7. Maximum Drawdown Function
    By jc94321 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-06-2005, 05:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1