Find the Maximum number in a series of Data

mayanksaini11

New Member
Joined
Aug 7, 2014
Messages
9
I have an Excel file in which I record my equity Portfolio value on a daily basis at the end of every day. I have a column named 'Drawdown' where I calculate the portfolio value from the peak portfolio value. When the value is below zero that means my portfolio is running below the peak. On the contrary, where the Drawdown value is zero, it means that the portfolio value is at its peak.
Now with this, I have a series of values in the Drawdown column. What I am trying to do is to find a minimum value in a series of values whenever I am in the drawdown phase. The output that I am trying to display in column E is mentioned below: Please suggest to me the formula to display the below output in column E in excel 2010.
A1B1C1D1E1
Trade DateDayPortfolio ValueDrawDownMax DrawDown
15/03/2023Wednesday16,848-
16/03/2023Thursday2,075-14,773
20/03/2023Monday-369-17,217Minimum
21/03/2023Tuesday1,313-15,535
23/03/2023Thursday5,900-10,948
24/03/2023Friday8,431-8,417
27/03/2023Monday4,929-11,919
28/03/2023Tuesday1,008-15,840
29/03/2023Wednesday6,295-10,553
31/03/2023Friday3,821-13,027
03/04/2023Monday18,594-
05/04/2023Wednesday20,683-
06/04/2023Thursday28,711-
11/04/2023Tuesday33,247-
12/04/2023Wednesday38,362-
18/04/2023Tuesday36,708-1,653
19/04/2023Wednesday35,694-2,667Minimum
20/04/2023Thursday43,699-
24/04/2023Monday38,567-5,132Minimum
25/04/2023Tuesday40,795-2,904
26/04/2023Wednesday43,977-
 
Okay, I have it 50% match. You need to tell me what is wrong.

mr excel questions 29.xlsm
ABCDEF
1Trade DateDayPortfolio ValueDrawDownMax DrawDownYour Expectation
22023-03-15Wednesday16,848Minimum
32023-03-16Thursday2,075-14,773 
42023-03-20Monday-369-17,217MinimumMinimum
52023-03-21Tuesday1,313-15,535 
62023-03-23Thursday5,900-10,948 
72023-03-24Friday8,431-8,417 
82023-03-27Monday4,929-11,919 
92023-03-28Tuesday1,008-15,840 
102023-03-29Wednesday6,295-10,553 
112023-03-31Friday3,821-13,027 
122023-04-03Monday18,5940 
132023-04-05Wednesday20,6830 
142023-04-06Thursday28,7110 
152023-04-11Tuesday33,2470 
162023-04-12Wednesday38,3620 
172023-04-18Tuesday36,708-1,654 
182023-04-19Wednesday35,694-2,668MinimumMinimum
192023-04-20Thursday43,6990 
202023-04-24Monday38,567-5,132 Minimum
212023-04-25Tuesday40,795-2,904Minimum
222023-04-26Wednesday43,9770 
Mayanksaini11
Cell Formulas
RangeFormula
E2:E22E2=IF(CHOOSE(IFS(ROW(E2)<=3,4,ROW(E2)<=12,1,ROW(E2)<=17,4,ROW(E2)<=19,2,ROW(E2)=20,4,ROW(E2)<=22,3,ROW(E2)>22,4),MIN($D$4:$D$12),MIN($D$18:$D$19),MIN($D$21:$D$22),"")=D2,"Minimum","")
D3:D22D3=C3-MAX($C$2:C3)
Yes, You have reached near. I would like to put some light on some discrepancies, which you have already highlighted in Yellow. Let me just clarify the flow of Data with the help of below image:
Max DD_v1.png

Here I have added for you 2 columns 'Daily PL' and 'Just for understanding' to explain the data more. Daily PL may be positive or negative, it affects the Cumulative Portfolio value. You can observe how this is happening.
Coming to the DD column, I have highlighted the different phases for better understanding. The data is Black and White, either the Portfolio is at its Peak/Highest Point/All time High or it is in the DD phase. There is no third scenario. Now when the Portfolio is at its Peak, there the DD is Zero, so there is no question of Max DD. Therefore in row 3 where the Portfolio is at All time high/Peak, there is no DD mentioned.

Phase 1
1st DD phase starts from row 4 where the Portfolio has come down a bit as compared to the previous value hence there is DD. This is the 1st day of 1st DD phase. This DD phase will go on till the Portfolio makes a new high or in other words, DD becomes zero which will happen in row 13. Therefore the Max DD value of this 1st phase i.e. E4-E12 is in cell E5 -17217.

From row 13 till Row 17 every day the Portfolio was making an all-time high. Therefore no DD, there is no question on Max DD.

Phase 2
2nd DD phase lasts for just two days in rows no. 18 and 19. The DD values have come from the formula. Out of the two days, on 19/04 the portfolio value was at minimum or DD was highest in the 2nd DD phase.

On 20/04/2023 the Portfolio was at All time high/Peak, hence no DD, no question of Max DD

Phase 3
Similarly, on 24/04/2023 the Portfolio has fallen from its peak and entered another DD phase. It lasts for only two days before it makes another All time high/Peak. In these two days, the Maximum DD was on 24-04-2023 which was -5132, or in other words the Portfolio value was at its minimum/Trough which was at 38567. On 25/04/2023 the Portfolio was on the 2nd day of the 3rd DD phase, though recovered from the Lowest point.

On 26/04/2023 Portfolio was at All time high, there is no DD and no question of Max DD.

So going by your formula, the 1st and 2nd Phase Max DD/Minimum portfolio point is well computed. The 3rd phase max DD is not well computed. It should be on -5132 and not -2904. Also on Day 1 when there was profit, the portfolio was at All time high there was no DD, the formula must be tweaked here also.

Really Appreciate your efforts.
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Okay, I realized I did not start the worksheet section on the correct row and that was putting the "Minimum" calculation on the wrong rows.

As I read your statement above, which is quite confusing as it uses terminology I am not comfortable with. I've asked you to just use column and value references. I'm trying to understand.

But there is one point of clarification that I need you to confirm:
when you say "Not in the drawn down period" you have stated that it is FIXED at:
1st phase of DD is within Cells D4 to D12,
2nd phase of DD is within Cells D18 to D19
3rd phase of DD is within Cells D21 to D22.

and then above you say it is based on the values in the cells (they are not negative)?

So, if it is the later, this is a clear example of how you have confused the reader by saying things that are not a part of any calculation.
So: Is your requirement for "Minimum" in column E really:
I want to identify the minimum value of consecutive groups of negative numbers in Column D?
(no investment terminology ... just a column letter and how values in the column are to be considered.)

Please clarify.
 
Upvote 0
Okay, I realized I did not start the worksheet section on the correct row and that was putting the "Minimum" calculation on the wrong rows.

As I read your statement above, which is quite confusing as it uses terminology I am not comfortable with. I've asked you to just use column and value references. I'm trying to understand.

But there is one point of clarification that I need you to confirm:
when you say "Not in the drawn down period" you have stated that it is FIXED at:
1st phase of DD is within Cells D4 to D12,
2nd phase of DD is within Cells D18 to D19
3rd phase of DD is within Cells D21 to D22.

and then above you say it is based on the values in the cells (they are not negative)?

So, if it is the later, this is a clear example of how you have confused the reader by saying things that are not a part of any calculation.
So: Is your requirement for "Minimum" in column E really:
I want to identify the minimum value of consecutive groups of negative numbers in Column D?
(no investment terminology ... just a column letter and how values in the column are to be considered.)

Please clarify.
Sorry for the inconvenience. The image that I pasted in my last message started the data range from row 2 and what you used in XL2bb was from row 1. So in your example, the DD ranges are:
1st phase of DD is within Cells D3 to D11 as against D4 to D12 in my example in image posted earlier
2nd phase of DD is within Cells D17 to D18 as against D18 to D19 in my example in image posted earlier
3rd phase of DD is within Cells D20 to D21 as against D21 to D22 in my example in image posted earlier


But there is one point of clarification that I need you to confirm:
when you say "Not in the drawn down period" you have stated that it is FIXED at:

"Not in the drawdown period" means there is no DD. DD is zero. DD is not fixed based on rows. It is based on the values.

So: Is your requirement for "Minimum" in column E really:
I want to identify the minimum value of consecutive groups of negative numbers in Column D?
Yes. In the DD column, there are 3 sets of consecutive numbers, I want the minimum value of each set separately.​
I hope I could clarify.​
 
Upvote 0
Okay, and I' not sure how to do that with formulas in Excel 2010, i've been trying to figure a way to select the top of the second group, and I'm having difficulties.
It is possible with 365 using the filter and xmatch functions, among others.
Since you have 2010 (you should update your profile button to display that by the way),
I think your best bet at this is a VBA solution. I am not proficient in that. I wish you luck.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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