Last Friday, we had a fun little Excel challenge – Calculate Maximum Change. More than 170 people commented and shared their solutions to this problem.
And the best part?
The best part is the variety of solutions & thinking displayed by our community. So if you are one of those 170, puff your chest & pat yourself on the back. Go ahead, I will wait.
Today, lets take a look at some of these awesome formulas and understand how they work. Read on and watch the video you below to gain few awesomeness pounds.
First, lets understand the problem
Here is a look at the problem:
We need more information to answer this question.
- Are we talking about positive change, negative change or absolute change?
- Are we talking about % change or value change?
In the original problem, even though I did not mention it, most people assumed that we want absolute change of value (ie the answer is 40, for Product 2).
But in real life, you may want to understand the problem a little more before writing any formulas.
Note: The data is in C3:C8 for last month and D3:D8 for this month.
Solution #1: Using MAX array formula
This is the solution most people got.
The array formula:
=MAX(C3:C8-D3:D8)
press CTRL+Shift+Enter after typing.
How it works?
C3:C8-D3:D8 portion: This gives the result {-20;40;15;21;0;-25} in array form.MAX(…) portion: This simply calculates the maximum value of above array and returns 40 as answer.
Why press CTRL+Shift+Enter (CSE)?
We need to press CTRL+Shift+Enter because MAX() is not capable of handling arrays. If you write MAX({-20;40;15;21;0;-25}) you would get 40, but the same array when calculated by doing math on ranges will not work. To force MAX to treat arrays, we need to press CTRL+Shift+Enter.
Solution #2: Using MAX+ABS array formula
Quite a few people figured out that the formula needs to work even when the change is negative. And that is where this new solution comes handy.
The array formula:
=MAX(ABS(C3:C8-D3:D8))
press CTRL+Shift+Enter after typing.
How it works?
ABS() portion: converts the change values {-20;40;15;21;0;-25} to positive {20;40;15;21;0;25}
Rest of the formula is same as solution #1.
Solution #3: Using INDEX to avoid Ctrl+Shift+Enter
The thing with Ctrl+Shift+Enter is that you have to remember it. If you accidentally press Enter instead of CSE, the formula stops working. One way to avoid this is to route the calculation thru an Excel function that can natively process arrays. This is where INDEX (or SUMPRODUCT etc.) come handy.
The formula:
=MAX(INDEX(C3:C8-D3:D8,0))
or
=MAX(INDEX(ABS(C3:C8-D3:D8),0))
How it works?
Same as Solution #1, except for this formula you do not have to press Ctrl+Shift+Enter. The INDEX will automatically calculate the array and send numbers to MAX. Then MAX feels mighty comfortable dealing with those numbers and spits out the answer as 40.
Learn more:
Solution #4: Using AGGREGATE
AGGREGATE() is a new function introduced in Excel 2010. This too, like INDEX & SUMPRODUCT can process arrays natively (provided you are using one of the aggregates like LARGE). Kyle, one of our commenters shared 2 brilliant solutions that involve AGGREGATE.
The formula:
=AGGREGATE(14,4,(C3:C8)-(D3:D8),1)
How it works?
14, 4 portion: This tells AGGREGATE that you want to calculate LARGE value (14) and you want to consider all cells (4). To understand more about AGGREGATE see the links below.
(C3:C8)-(D3:D8) portion: As seen above, this just gives an array – {-20;40;15;21;0;-25}
1 portion: This tells AGGREGATE that you want 1st largest number.
Learn more:
Solution #5: Using MMULT and AGGREGATE
Now this is what I call a scary formula. It can potentially waste your entire afternoon when you try to understand it first time. But once you get it, you feel awesome. This too is posted by Kyle.
The formula:
=AGGREGATE(14,4,MMULT(C3:D8,{1;-1}),1)
How it works?
Watch the video. Explaining how this works in text is difficult.
Learn more:
I am still trying to understand MMULT(). It can be as complex and deep as string theory (or recipe of making bread at home). Go thru below links to learn more about it. Make sure you put on your helmet, cause it will blow your mind.
More ways to get maximum change + Bonus problem
Watch below video to understand how to solve the maximum change problem and another related problem.
Click here to watch if you can’t see the video above
Download Answer workbook
Click here to download answer workbook and examine the formulas to learn more.
What did you learn from this formula challenge?
I learned how to use AGGREGATE, Array SUMIFS and got a better handle on MMULT.
What about you? What did you learn thru this challenge. Please comment and let us all know.
One Response to “Loan Amortization Schedule in Excel – FREE Template”
The balance formula as given doesnt seem to work on my excel