I spent a little time overlooking all the solutions and in attachment, you see the result.
I made a function for both point of views. : F_MaxVZ en F_LongestPeriod, so you need that xla no longer.
The results fo those functions are the orange and light blue cells in "blad1" (cells K7 and N7)
there you enter the formula
and you make an enter, then you select 6 cells K7:L9, you push F2 and then CTRL-SHIFT-ENTER (those 3 keys together) and you have your answer. Now you only have to change the formats to date and valuta.
The yellow and dark blue cells are the result of the macros (push the green buttons), but you don't need them no more, you can delete the buttons and the macros.
There is 1 difference between the 2 functions :
I modified the last cell B5000 to 800, so there is a feasible solution and both functions become the same result.
If you change that cell to 700, then for a certain date(2108-10-11 valuta 741.25€) you can't find a longest period, because that period isn't finished yet.
So my solution (orange cells) gives NA (No Answer of Not Available), the MaxVZ gives the best feasible solution.
So it's up to your exceptations, i can modify my function, so that the answer is the same.
Bookmarks