Calculate the average % of a compounded increase with Excel formulas - excel-formula

I'm trying to calculate the average % of a compounded increase.
For example, if $100 increases by 5% over three years, the average % increase over the whole period is 10.34%.
100.00 + 5% = 105.00, 105.00 + 5% = 110.25, 110.25 + 5% = 115.76, AVERAGE(105,110.25,115.76) = 110.34, (110.34 - 100) / 100 = 10.34%
I'm currently calculating this with lots of IF statements because duration, percent, and starting values are variable…
=((100*1.05+IF(3>=2,100*(5/100+1)^2)+IF(3>=3,100*(5/100+1)^3))/3-100)/100
my actual formula contains many, many more lines to catch durations up to 25 years which is why I'm looking to scale it down with some intelligent calculations
The results will be shared with other teams who don't use VBA, so needs to utilize in-built formulas.
Thank you,

Your basic formula would be:
=(AVERAGE(FV(0.05,{1,2,3},0,-100))-100)/100
This is an array formula and must be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode.
Now if one wants the inputs to be dynamic(pointed at input cells) then we need to change the formula a little:
=(AVERAGE(FV(B2,ROW($ZZ$1:INDEX($ZZ:$ZZ,B1)),0,B3))+B3)/(-B3)
Still an array formula
NOTE: If one has the dynamic array formula SEQUENCE it can be done without the need of CSE with:
=(AVERAGE(FV(B2,SEQUENCE(B1),0,B3))+B3)/(-B3)

The math solution is
=((1+R)^N-1)*(1+R)/(R*N)-1
where R is the rate and N is the number of periods.

Related

Can't figure out why excel is rounding currency

Here is my excel table:
The cell with 8.83 = =((C8-B8)*24)-D8
*C8 = 4:50PM
*B8 = 7:30AM
*D8 = 0.50
The cell $371.00 = =(E8*B3)
Why does my total show $371.00 when B3 = $42? It should be $370.86. I don't have it set to round but for some reason it keeps on doing it.
Because, the actual result of formula =((C8-B8)*24)-D8 is 8.833333333. Due to cell formatting you are seeing 8.83. If you want result for only two digit after decimal point then use round function like-
=ROUND(((C8-B8)*24)-D8,2)
Then you will get result 370.86. Or you can directly use in resulting cell.
=ROUND(E8,2)*B3
$371 is “technically” the correct amount, mathematically. You are actually doing rounding when you are hand-calculating your cross-check, and that isn’t matching Excel’s unfounded calculation.
( 4:50pm - 7:30am ) is 9.3333333 repeating, or “9-1/3”. Divided by 24 leaves you 8.8333333 repeating, not 8.83. Excel is doing what it’s supposed to do, and 371.00 is the correct amount. If your use case calls for times to be rounded to .01 hours and no further then you’ll need to apply rounding somewhere in cell E8.

Return more than 1 value in Excel table (for calculating total route distance)

I made this Excel sheet to calculate total distance of a particular route and to keep track of trips. However, it makes many calculations which will eventually make it very slow (even more if routes have many stops).
In the image, Column P is the distance between PLACE_1 and PLACE_2, Column Q is the distance between PLACE_2 and PLACE_3 and so on. Column O is the sum of all these distances.
I used =INDEX(distance_table, MATCH(), MATCH()) to find the distances
This is the distance_table (distances are not real, just an example):
So as you can see, it works but it is very inefficient, the index/match formula will be used 10 times per trip.
What could be done to improve it? (considering there could be more than 10 stops per trip)
Thanks in advance!
You can use SUM/INDEX/MATCH/MATCH array formula:
=SUM(IFERROR(INDEX($B$2:$J$10,N(IF(1,MATCH($A$15:$J$15,$A$2:$A$10,0))),N(IF(1,MATCH($B$15:$K$15,$B$1:$J$1,0)))),0))
Array formula after editing is confirmed by pressing ctrl + shift + enter
Not intended as an answer. because in terms of performance index/match is faster, just as an alternative and maybe it can give you ideas:
Setup:
Formula:
=SUMPRODUCT(($B$6:$B$14=B3)*($C$5:$K$5=C3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=C3)*($C$5:$K$5=D3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=D3)*($C$5:$K$5=E3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=E3)*($C$5:$K$5=F3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=F3)*($C$5:$K$5=G3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=G3)*($C$5:$K$5=H3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=H3)*($C$5:$K$5=I3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=I3)*($C$5:$K$5=J3);$C$6:$K$14) +
SUMPRODUCT(($B$6:$B$14=J3)*($C$5:$K$5=K3);$C$6:$K$14)

How do I calculate the number of years to target in Microsoft Excel

If I have an average YOY growth of say 2.5%, current year sales of $500,000, and target sales of $1,000,000. Is there a way to calculate the number of years until I hit my target (assuming a continued YOY growth rate of 2.5%), without calculating each additional years's sales on a different row?
You can use the NPER function for this:
=NPER(Growth,0,currentSales,-targetSales)
Note that this gives the same result as #Dominique, but is using a built-in Excel function.
Also, by virtue of the nature of Excel financial functions, the signs for the current and future Sales need to be different.
There's a simple formula for this:
Money_end = (1+r/100)^Y*Money_begin
Where:
Money_begin = the starting amount of money, in this case 500000.
Money_end = the finishing amount of money, in this case 1000000.
r = the percent ratio, in this case 2.5.
Y = the amount of years, which you are looking for.
So, your question comes down to solving this equation:
1000000 = (1+2.5/100)^Y * 500000
2 = 1.025^Y
Y = log(2)/log(1.025)
If you want this to be solved by Excel, you might use the formula and use the Solver basic Excel feature for coming up with the same (but numerical instead of analytical) result.

How to exclude 0 from MIN formula Excel

i need to know how can i exclude 0 from rows and get the MIN Value.
But also i need to exlude the F1 Cell.
Ex:
A B C D E F
1 0 18 20 0 150 = 18
but if i do this In excel with =MIN(A1,B1,C1,D1,E1) return 0.
Any help is appreciated.
Try this formula
=SMALL((A1,C1,E1),INDEX(FREQUENCY((A1,C1,E1),0),1)+1)
Both SMALL and FREQUENCY functions accept "unions" as arguments, i.e. single cell references separated by commas and enclosed in brackets like (A1,C1,E1).
So the formula uses FREQUENCY and INDEX to find the number of zeroes in a range and if you add 1 to that you get the k value such that the kth smallest is always the minimum value excluding zero.
I'm assuming you don't have negative numbers.....
Enter the following into the result cell and then press Ctrl & Shift while pushing ENTER:
=MIN(If(A1:E1>0,A1:E1))
Not entirely sure what you want here, but if you want to discount blank cells in the range and pass over zeros then this would do it; if a little contrived:
=MIN(IF(A1:E1=0,MAX(A1:E1),A1:E1))
With Ctrl+Shift+Enter as an array.
What I'm doing here is replacing zeros with the maximum value in the list.
if all your value are positive, you can do -max(-n)
Solutions listed did not exactly work for me. The closest was Chief Wiggum - I wanted to add a comment on his answer but lack the reputation to do so. So I post as separate answer:
=MIN(IF(A1:E1>0;A1:E1))
Then instead of pressing ENTER, press CTRL+SHIFT+ENTER and watch Excel add { and } to respectively the beginning and the end of the formula (to activate the formula on array).
The comma "," and "If" statement as proposed by Chief Wiggum did not work on Excel Home and Student 2013. Need a semicolon ";" as well as full cap "IF" did the trick. Small syntax difference but took me 1.5 hour to figure out why I was getting an error and #VALUE.
Throwing my hat in the ring:
1) First we execute the NOT function on a set of integers,
evaluating non-zeros to 0 and zeros to 1
2) Then we search for the MAX in our original set of integers
3) Then we multiply each number in the set generated in step 1 by the MAX found in step 2, setting ones as 0 and zeros as MAX
4) Then we add the set generated in step 3 to our original set
5) Lastly we look for the MIN in the set generated in step 4
{=MIN((NOT(A1:A5000)* MAX(A1:A5000))+ A1:A5000)}
If you know the rough range of numbers, you can replace the MAX(RANGE) with a constant. This speeds things up slightly, still not enough to compete with the faster functions.
Also did a quick test run on data set of 5000 integers with formula being executed 5000 times.
{=SMALL(A1:A5000,COUNTIF(A1:A5000,0)+1)}
1.700859 Seconds Elapsed |
5,301,902 Ticks Elapsed
{=SMALL(A1:A5000,INDEX(FREQUENCY(A1:A5000,0),1)+1)}
1.935807 Seconds Elapsed |
6,034,279 Ticks Elapsed
{=MIN((NOT(A1:A5000)* MAX(A1:A5000))+ A1:A5000)}
3.127774 Seconds Elapsed |
9,749,865 Ticks Elapsed
{=MIN(If(A1:A5000>0,A1:A5000))}
3.287850 Seconds Elapsed |
10,248,852 Ticks Elapsed
{"=MIN(((A1:A5000=0)* MAX(A1:A5000))+ A1:A5000)"}
3.328824 Seconds Elapsed |
10,376,576 Ticks Elapsed
{=MIN(IF(A1:A5000=0,MAX(A1:A5000),A1:A5000))}
3.394730 Seconds Elapsed |
10,582,017 Ticks Elapsed
min() fuction exlude BOOLEAN and STRING values.
if you replace your zeroes with "" (empty string) - min() function will do its job as you like!
In Microsoft 365 you can use the new function MINIFS
=MINIFS(A1:E1;A1:E1;">0")
gives 1
=MINIFS(A1:E1;A1:E1;">1")
gives 18
*replace ; with , if using english version
All you have to do is to delete the "0" in the cells that contain just that and try again. That should work.

Binning in Excel

Which formulae in MS Excel can we use for -
equi-depth binning
equi-width binning
Here's what I used. The data I was binning was in A2:A2001.
Equi-width:
I calculated the width in a separate cell (U2), using this formula:
=(MAX($A$2:$A$2001) - MIN($A$2:$A$2001) + 0.00000001)/10
10 is the number of bins. The + 0.00000000001 is there because without it, values equal to the maximum were getting put into their own bin.
Then, for the actual binning, I used this:
=ROUNDDOWN(($A2-MIN($A$2:$A$2001))/$U$2, 0)
This function is finding how many bin-widths above the minimum your value is, by dividing (value - minimum) by the bin width. We only care about how many full bin-widths fit into the value, not fractional ones, so we use ROUNDDOWN to chop off all the fractional bin-widths (that is, show 0 decimal places).
Equi-depth
This one is simpler.
=ROUNDDOWN(PERCENTRANK($A$2:$A$2001, $A2)*10, 0)
First, get the percentile rank of the current cell ($A2) out of all the cells being binned ($A$2:$A$2001). This will be a value between 0 and 1, so to convert it into bins, just multiply by the total number of bins you want (I used 10). Then, chop off the decimals the same way as before.
For either of these, if you want your bins to start at 1 rather than 0, just add a +1 to the end of the formula.
Best approach is to use the built-in method:
http://support.microsoft.com/kb/214269
I think the VBA version of the addin (step 3 with most versions) will also give you the code.
Put this formula in B1:
=MAX( ROUNDUP( PERCENTRANK($A$1:$A$8, A1) *4, 0),1)
Fill down the formula all across B column and you are done. The formula divides the range into 4 equal buckets and it returns the bucket number which the cell A1 falls into. The first bucket contains the lowest 25% of values.
General pattern is:
=MAX( ROUNDUP ( PERCENTRANK ([Range], [TestCell]) * [NumberOfBuckets], 0), 1)
You may have to build the matrix to graph.
For the bin bracket you could use =PERCENTILE() for equi-depth and a proportion of the difference =Max(Data) - Min(Data) for equi-width.
You could obtain the frequency with =COUNTIF(). The bin's Mean could be obtained using =SUMPRODUCT((Data>LOWER_BRACKET)*(Data<UPPER_BRACKET)*Data)/frequency
More complex statistics could be reached hacking around with SUMPRODUCT and/or Array formulas (which I do not recommend since are very hard to comprehend for a non-programmer)

Resources