How to Calculate Maximum Drawdown in Excel and Google Sheets

Published on

You can use the following dynamic array formula to calculate maximum drawdown (MDD) in Excel and Google Sheets:

=LET(
   prices, range, 
   running_max, IF(prices, SCAN(CHOOSEROWS(prices, 1), prices, LAMBDA(acc,val, MAX(val, acc))),), 
   drawdown, prices-running_max, 
   drawdown_P, IFERROR(drawdown/running_max,0), 
   MIN(drawdown_P)
)

Where range refers to the prices column. When using this formula in Google Sheets, enter it as an array formula.

Understanding Maximum Drawdown (MDD)

Maximum Drawdown (MDD) is a commonly used metric among investors to evaluate the risk and performance of investments. The calculation is represented mathematically as:

(Trough Value – Peak Value) ÷ Peak Value

It quantifies the largest decline from a historical peak to a trough in a series of values before establishing a new peak.

Key Characteristics of the Formula:

  • Compatibility: Works in both Excel and Google Sheets.
  • Dynamic Array Formula: Returns the result in a single step without requiring helper columns.
  • Ease of Use: Modify the range reference in one place to adapt the formula to your dataset.
  • Flexible Output: Calculate the maximum drawdown percentage (default) or the maximum drawdown by replacing MIN(drawdown_P) with MIN(drawdown).
  • Detailed Analysis: Display the peak (running max), drawdowns, and drawdown percentages row by row by replacing MIN(drawdown_P) with the relevant variable names.

Example: Calculating Maximum Drawdown in Excel

Assume you have the following sample data in A1:B8 in your Excel spreadsheet:

Spreadsheet example of maximum drawdown calculation

To calculate the maximum drawdown, use the following formula in an empty cell:

=LET(
   prices, B2:B8, 
   running_max, IF(prices, SCAN(CHOOSEROWS(prices, 1), prices, LAMBDA(acc,val, MAX(val, acc))),), 
   drawdown, prices-running_max, 
   drawdown_P, IFERROR(drawdown/running_max,0), 
   MIN(drawdown_P)
)

The formula will return -0.25 as the maximum drawdown (MDD).

Formula Breakdown:

  1. IF(prices, SCAN(CHOOSEROWS(prices, 1), prices, LAMBDA(acc, val, MAX(val, acc)))): Calculates the running maximum (running_max).
  2. prices - running_max: Calculates the drawdown (drawdown).
  3. IFERROR(drawdown / running_max, 0): Calculates the drawdown percentage (drawdown_P).
  4. MIN(drawdown_P): Finds the minimum drawdown percentage, which is the maximum drawdown.

Viewing Detailed Calculations:

To see the values of running max, drawdown, and drawdown percentage row by row:

  1. Clear the range C2:E8.
  2. Copy the maximum drawdown formula into C2.
  3. Replace MIN(drawdown_P) in the formula with HSTACK(running_max, drawdown, drawdown_P).
Detailed drawdown calculation in Excel

The updated formula will be:

=LET(
   prices, B2:B8, 
   running_max, IF(prices, SCAN(CHOOSEROWS(prices, 1), prices, LAMBDA(acc,val, MAX(val, acc))),), 
   drawdown, prices-running_max, 
   drawdown_P, IFERROR(drawdown/running_max,0), 
   HSTACK(running_max, drawdown, drawdown_P)
)

Example: Calculating Maximum Drawdown in Google Sheets

The array formula behaves slightly differently in Excel and Google Sheets. In Excel 365, the formula dynamically applies to the range used. In Google Sheets, you must enter it as an array formula.

Using the same sample data from Excel in Google Sheets, enter the following formula:

=ARRAYFORMULA(
   LET(
      prices, B2:B8, 
      running_max, IF(prices, SCAN(CHOOSEROWS(prices, 1), prices, LAMBDA(acc,val, MAX(val, acc))),), 
      drawdown, prices-running_max, 
      drawdown_P, IFERROR(drawdown/running_max,0), 
      MIN(drawdown_P)
   )
)

This will return the maximum drawdown in Google Sheets.

The only difference is the outer ARRAYFORMULA in Google Sheets, which ensures the formula works across a range.

In Excel, you can specify a larger range, such as B2:B1000, since dynamic ranges are not supported the same way as in Google Sheets.

In Google Sheets, you can extend the range dynamically by replacing B2:B8 with B2:B to include future values.

Conclusion

This guide demonstrates how to calculate maximum drawdown in Excel and Google Sheets using a single dynamic formula. The formula provides a simple, helper-column-free solution to calculate MDD.

Additionally, the formula is flexible enough to accommodate future values and display underlying calculations. To gain more insights, use the formula to output running max, drawdown, and drawdown percentages in separate columns.

With this method, you can efficiently assess the maximum drawdown and improve your investment analysis in both Excel and Google Sheets.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Running Count with Structured References in Google Sheets

Running a count with structured references is achievable in Google Sheets tables using the...

Running Total with Structured Table References in Google Sheets

You can use two types of formulas to create a running total with structured...

Automate Multi-Colored Line Charts in Google Sheets

Usually, a line chart with a single line supports only one color. To create...

Calculate the Number of Nights in Each Month in Google Sheets

When working with date ranges, such as check-in and check-out dates, it’s often useful...

More like this

Lookup Previous Values Dynamically in Excel and Google Sheets

Sometimes, you may want to look up the previous values relative to the current...

Sort Data but Keep Blank Rows in Excel and Google Sheets

Using a dynamic array formula or the FILTER command, we can sort data and...

Lookup Values Under Categories in Excel and Google Sheets

We can use a combination of XLOOKUP and VLOOKUP in both Excel and Google...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.