Calculating Total based on Different Discount Rates - excel

I’m trying to calculate the total contract value on a list of projects with different monthly rates and terms (#months). Basically you get a nice discount if the term is longer than 24 months however the discount is capped at $1,000 (you can’t discount more than $1,000)
0-24 months:Full Price
25-48 months:50% of the full price (capped at $1,000)
49 onwards:25% of the full price (capped at $1,000)
Attached is my spreadsheet and the calculated total works well for some monthly rates but the formula doesn’t work well for lower monthly amounts. I have two columns, Calculated Total and Desired Total (what the total should be). Any idea how I can fix the Calculated Total Formula to get the desired total? Thank you
Amount Term Calculated Total Desired Total
1500 68 $74,000 $80,000
1000 48 $36,000 $48,000
4000 36 $120,000 $120,000
3000 30 $81,000 $81,000
2000 27 $51,000 $51,000
4000 120 $216,000 $216,000
NumMonths Base Discount
0 0 1.00
24 24 0.50
48 36 0.25
Formula:
=A2*VLOOKUP(B2,$F$2:$H$4,2)+A2*(B2-VLOOKUP(B2,$F$2:$F$4,1))*IF((A2*VLOOKUP(B2,$F$2:$H$4,3))<1000,1000/A2,VLOOKUP(B2,$F$2:$H$4,3))

In order to get to a solution I changed the setup of your sheet slightly (beginning, end, discount and max. discount):
In order to get to your solution, you just have to multiply the different tiers with the terms for each tier. I used IF functions to do this:
IF(B2>$G$2,$G$2,B2)*IF(A2*(1-$H$2)<$F$7,$F$7,A2*(1-$H$2))+IF(B2>$G$3,$G$3-$G$2,IF(B2-$G$2<0,0,B2-$G$2))*IF(A2*(1-$H$3)<$F$7,$F$7,A2*(1-$H$3))+IF(B2-$G$3>0,B2-$G$3,0)*IF(A2*(1-$H$4)<$F$7,$F$7,A2*(1-$H$4))

Related

Returning a value based on multiple criteria and ranges of numbers

I am looking for a way to do some type of lookup/match to come up
with bonuses. It is based on what they sold, for how much, and based on how much they sold last year, and the amount increased.
Example Line 2: So say they sold $900 worth of pens to Joe (New Amount is w/in 1-999). Last
year Joe only bought $23 worth of pens (Previous Amount is w/in 1-24) they get a $25 bonus (Bonus). Also..
There also has to be a minimum increase amount (Min increase column). So say if Joe bought
$999 worth of pens last year and $1000 worth of pens this year, the
salesperson shouldn't get a bonus because it was only a buck increase. It has to be at least $50 increase in this case. That's what the Min Increase column is.
Group Min Increase Previous Amount New Amount Bonus
Min Max Min Max
Pens 50 1 24 1000 999999 45
Pens 50 1 24 1 999 25
Pens 50 25 100 1000 999999 45
Pens 5 25 100 1 999 25
Paper 10 1 24 1000 999999 50
Paper 10 1 24 1 999 25
Paper 10 25 100 1000 999999 50
Paper 5 25 100 1 999 25
I started looking at Indexmatching but it's not enough. Then I thought of summing, but it's really not adding anything together.
=SUMIFS(B3:B10, G1:G10, "Pens", D3:D10, "50")
Also, =INDEX(range2,MATCH(TRUE,COUNTIF(range1,range2)>0,0)) won't work because that's only two ranges.
It also has to be something they can update constantly.
The actual data looks something like this
Sale Prev. Group
900 23 Pens
So you'd need to find the difference, see if it's within the minimum increase for the group and the amounts (900-23 > 50). Then return a value. 23 is between 1 and 24 and 900 is between 1 and 999 so $25 bonus.
Does anyone have any suggestions? I'm looking into index matching, but I can't find out how to do it with ranges.
Thanks
The formula is based on aggregate which performs array like operations. As such keep full column references inside of the aggregate function as short as you can and avoid full column references. Based on the layout of information in the picture above, place the following formula in L3 and copy down as required.
=IFERROR(INDEX(G:G,AGGREGATE(15,6,ROW($A$3:$A$10)/(($A$3:$A$10=$K3)*($C$3:$C$10<=$J3)*($D$3:$D$10>=$J3)*($E$3:$E$10<=$I3)*($F$3:$F$10>=$I3)*((I3-J3)>=$B$3:$B$10)),1)),"No Bonus")
Caveat: If for some reason, the sales situation matches multiple rows in your table, then it will return the bonus corresponding to the lowest row number that met all the criteria.

(Excel)Calculating costs, where prices differ based on quantities

I'm looking for some help as I'm not really sure of the correct terms to use on my query below, so whilst normally I would google this, I'm not really sure what to search for.
I need to work out the total cost for something, where you have a flat rate, and then an additional cost that changes depending on how much of something you have.
So an example, you get expenses paid for millage. If you drive 0-20 miles, you'll get £10. Between 30-50 miles you get 50p per mile. Between 51-100 miles you get £1 per mile and so on, added onto the base rate of the initial £10 you'd get paid as standard.
It's not the best example, but hoping it gives an idea of what I'm after.
If I was doing this by hand I'd know how to work it out, but I'm not to sure what kind of formula I need to be using - I've never had to work with complex formulas past "=sum" until now.
If anyone has any examples they can share or can point me in the right direction of what kind of things to google I'd be most grateful !
Thanks
Well, here is one way, but you don't state what the rate is between 21 and 30...
very basic, but you should be able to edit and expand as you want.
Do note that the limits (30 miles, 50 miles) and rates used in the formula all come from the sheet - so if the 30 mile limit changes to 25 miles - all you need to do is change cell A7...
I apologize for not answering sooner, but I find this question a bit difficult to address due to the complexity of formulas we can encounter. I know the one you documented is not the most complex one we might encounter, but I was not sure if that was your actual problem or if it was intended as a simple example. I have seen a variety of other things which have often thrown me for a loop.
For example, take this set of rules:
Minimum Fee is $23.50 up to $500
$501 - $2,000 = $3.05 per 100 unit increment
$2,001 - $25,000 = $14.00 per 1000 unit increment over $2,000
$25,001 - $50,000 = $10.10 per 1000 unit increment over $25,000
$50,001 - $100,000 = $7.00 per 1000 unit increment over $50,000
$100,001 - $500,000 = $5.60 per 1000 unit increment over $100,000
$500,001 - $1,000,000 = $4.75 per 1000 unit increment over $500,000
$1,000,001 - $9,999,000 = $3.65 per 1000 unit increment over $1,000,000
$10,000,001 and up = $3.65 per 1000 unit increment over $10,000,000
It does not look too different from yours except that there is an increment of something other than a single unit. In other words for the $501 to $2,000 range, $501 to $600 would all get the same additional $3.05 incremental charge. Another dollar would actually double this because it jumps to the next increment. Like your example, each range builds on the prior range. Assuming that these amounts are in colums A through F:
i Low High Fee Base Fee Per
0 1 500 23.50
1 501 2,000 $3.05 100
2 2,001 25,000 $23.50 1000
3 25,001 50,000 $10.10 1000
4 50,001 100,000 $7.00 1000
5 100,001 500,000 $5.60 1000
6 500,001 1,000,000 $4.75 1000
7 1,000,001 9,999,999 $3.65 1000
8 10,000,000 $3.65 1000
Note also that the rate declines as the amounts increase whereas yours appears to increase.
What I did with this is create a maximum value in Column H as follows:
i Max
0 =E3
1 =INT((C4-C3)/F4)*D4
2 =INT((C5-C4)/F5)*D5
3 =INT((C6-C5)/F6)*D6
4 =INT((C7-C6)/F7)*D7
5 =INT((C8-C7)/F8)*D8
6 =INT((C9-C8)/F9)*D9
7 =INT((C10-C9)/F10)*D10
8
The first one, where i is zero, is simply the base fee. The others are computed and copied. There is no maximum for the last row. I did not really think I needed this column but it made it easier to devise the formulas.
Assuming that I put an amount to evaluate in Cell I2, it will be evaluated as follows where the formula in row 3 (where i=0) is the set fee but all others are basically a copied formula:
i 4,950
0 =IF(I$2>=$B3,$H3,0)
1 =IF(I$2>=$B4,IF($H4="",INT((I$2-$C3)/$F4)*$D4,MIN($H4,INT((I$2-$C3)/$F4)*$D4)),0)
2 =IF(I$2>=$B5,IF($H5="",INT((I$2-$C4)/$F5)*$D5,MIN($H5,INT((I$2-$C4)/$F5)*$D5)),0)
3 =IF(I$2>=$B6,IF($H6="",INT((I$2-$C5)/$F6)*$D6,MIN($H6,INT((I$2-$C5)/$F6)*$D6)),0)
4 =IF(I$2>=$B7,IF($H7="",INT((I$2-$C6)/$F7)*$D7,MIN($H7,INT((I$2-$C6)/$F7)*$D7)),0)
5 =IF(I$2>=$B8,IF($H8="",INT((I$2-$C7)/$F8)*$D8,MIN($H8,INT((I$2-$C7)/$F8)*$D8)),0)
6 =IF(I$2>=$B9,IF($H9="",INT((I$2-$C8)/$F9)*$D9,MIN($H9,INT((I$2-$C8)/$F9)*$D9)),0)
7 =IF(I$2>=$B10,IF($H10="",INT((I$2-$C9)/$F10)*$D10,MIN($H10,INT((I$2-$C9)/$F10)*$D10)),0)
8 =IF(I$2>=$B11,IF($H11="",INT((I$2-$C10)/$F11)*$D11,MIN($H11,INT((I$2-$C10)/$F11)*$D11)),0)
The Fee for this is the sum of all of the rows (labeled i, 0 through 8 above). in this example, it would be 23.50 plus 45.75 plus 28.00 for a total of 97.25.
Not too bad. How about a set like this:
No fee if $1,000 or less
$1,001 - $5,000 = $80.00 + 3% of excess over $1,000.00 per 100 unit increment
$5,001 - $10,000 = $250.00 + 2% of excess over $5,000.00 per 500 unit increment
$10,001 - $25,000 = $350.00 + 1% of excess over $10,000.00 per 1000 unit increment
$25,001 and Over = $520.00 + 3/4% of excess over $25,000.00 per 1000 unit increment
In your formula, the initial flat amount never changes and once you've computed the amount for that range, other ranges build upon it. Here, there are steps. For example at $1,000 the fee is zero, but at $1,001, it jumps to $80 as if there were an $80 fee for the first 1000. Without boring you with the entire table, Here is the formula for computing the range from 5,001 to 10,000 assuming that G2 contains the amount to use and Row 5 colums A through E are the following:
Low High Rate Minimum Increment
5,001 10,000 2.00% 250 500
=($D5+$C5*INT(($G$2-($A5-1))/$E5)*$E5)*($G$2>=$A5)*OR($B5="",$G$2<=$B5)
The formula simply looks at the current row and does the computation if the amount in G2 falls within the range from Column A to Column B.
A simplification of all of the above comes when each range cumulatively builds on the prior ranges AND the rate of payment is always increasing, like the U.S. Tax Tables:
Over Not Over
0 9,525 10% of taxable income
9,525 38,700 $952.50 plus 12% of the excess over $9,525
38,700 82,500 $4,453.50 plus 22% of the excess over $38,700
82,500 157,500 $14,089.50 plus 24% of the excess over $82,500
157,500 200,000 $32,089.50 plus 32% of the excess over $157,500
200,000 500,000 $45,689.50 plus 35% of the excess over $200,000
500,000 $150,689.50 plus 37% of the excess over $500,000
Here, we can use something referred to as the "deskpad method" to shortcut the computation
Assuming that the amount to be evaluated is in G1 and these are in column A through C starting in Row 1:
Over Not Over Rate
0 9,525 10.0%
9,525 38,700 12.0%
38,700 82,500 22.0%
82,500 157,500 24.0%
157,500 200,000 32.0%
200,000 500,000 35.0%
500,000 37.0%
We compute the amount based on G1 as follows:
=ROUND(SUMPRODUCT($C$2:$C$8-$C$1:$C$7,$G$1-$A$2:$A$8,N($G$1>$A$2:$A$8)),0)
Note: this is not entered as an array formula.
How does this relate to your question. If the need is as simple as you stated (in other words, the rate is always increasing and we do not have any "steps" in the reimbursement, we can compute it similarly to the U.S. Tax computation.
I created these values in columns A through D starting in row 1:
Over Not Over
0 20 £- Flat Amount of £10.00
20 50 £0.50 £10.00 plus £.50 per mile over 20 miles
50 100 £1.00 £25.00 plus £1.00 per mile over 50 miles
100 £1.50 £75.00 plus £1.50 per mile over 100 miles
where column D is just descriptive. I put the £10.00 flat fee in Cell E1.
Assuming that G1 contains the number of miles, we would compute the reimbursement as:
=$E$1+ROUND(SUMPRODUCT($C$2:$C$5-$C$1:$C$4,$G$1-$A$2:$A$5,N($G$1>$A$2:$A$5)),2))
For example, when G1 is 52 miles, the computation is £27.00
Note: this is not entered as an array formula.
So, if this is the situation, what you would need is a place to house Columns A through C, a place to house the flat amount and a formula similar to what I provided to compute the reimbursement based on the cell housing the number of miles.
Please note that all the earlier items indicate that this formula will not be so simple if the rate is stepped or the rate declines or if the incremental unit is something other than 1 mile.
I hope that some of this makes sense. Good luck.
Things to google : "nested IF in excel"
How to do this in a one-line-formula : enter " =IF(A1<20,10,IF(A1>50,IF(A1>50,10+A1,"u"),0.5*(A1))) " in B1, your milage in A1.
To learn building this :
identify the conditions :
condition1 > 0-20 miles, you'll get £10.
condition2 > between 30-50 miles you get 50p per mile
condition3 > between 51-100 miles you get £1 per mile added onto £10
put the conditions into IF() statement
For contition1 > just type " =if(a1<20,10,0) " at B2 (and try it!) (:
Note : The syntax for IF() function is if("condition","if-true-do-this","if-false-do-this")
Thus, for condition2 > " =if(a1>20,a1*0.5,0) "
And for condition3 > " =if(a1>50,if(a1>50,10+a1),0) " correction : should be " =if(a1>50,10+a1,0) "
Combining all the conditions > "=IF(A1>20,IF(A1>50,IF(A1>50,10+A1,"error"),0.5*(A1)),10) "
Notice that I changed 0 in the "if-false-do-this" part of the equation just to make sure it show something when the milage entered is less than 0.
Hope that helps. /(^_^)

Wrong total on measure with IIF

I have a very simple set [Sales Set]:
{
[Accounts Master].[Account Code].&[XXXXX1]
, [Accounts Master].[Account Code].&[XXXXX2]
...
[Accounts Master].[Account Code].&[XXXX20]
}
I ultimately want to create a calculated measure that will get its value from measure Gross Sales when the account is in this set or from an account group I have specified (let's call it Sample Account) and from Net Sales when it is not.
So far I have used the following measure [Sales Measure] to achieve that:
IIF
(
Exists
(
[Sales Set]
,[Accounts Master].[Customer Description].CurrentMember
).Count
= 1
OR
Exists
(
[Accounts Master].[Account Group].&[Sample Account]
,[Accounts Master].[Customer Description].CurrentMember
).Count
= 1
,[Measures].[Gross Sales]
,[Measures].[Net Sales]
)
This does what I want but the total disregards anything that is not in the [Sales Set] or in the Account Group [Sample Account].
This is what happens:
Account Group **Sales Measure** Gross Sales Net Sales
XXXXX1 **20** 20 12
XXXXX2 **45** 45 35
YYYYY1 **15** 25 15
YYYYY2 **30** 40 30
__________________________________________________________
Total **65** 130 92
Everything is as it should except the Total.
In this example the total for Sales Measure should be 110.
Is there a way that I can achieve the same functionality that I have now but also having the total being calculated correctly?
EDIT: On closer inspection the results are like these:
Account Group **Sales Measure** Gross Sales Net Sales
XXXXX1 **20** 20 12
XXXXX2 **45** 45 35
YYYYY1 **15** 25 15
YYYYY2 **30** 40 30
__________________________________________________________
Total **130** 130 92
So it seems that the total of Sales Measure is always the same as the Gross Sales total.

What is the proper formula in getting the total scorecard?

I have this certain part of my exercise I just can't finish solving:
Data:
Kpi1 15
Kpi2 25
Kpi3 10
Kpi4 44
Question. What is the total score?
Kpi1 goal- <=20
Weight- 10%
Kpi2 goal- >=20
Weight- 50%
Kpi3 goal- >=20
Weight- 20%
Kpi4 goal- >=40
Weight- 20%
Assuming your scores by KPI are in B1:B4, maybe:
=(B1<=20)*0.1+(B2>=20)*0.5+(B3>=20)*0.2+(B4>=40)*0.2

random number based on probability in Excel

How can I create a random number generator which calculates a random number based on a probability?
For example, I have the following numbers with the probability they will occur starting in cell A1 and B1:
100 5%
75 10%
50 42%
30 30%
15 5%
0 8%
Thus, the formula would "randomly" return the number "15" 5% of all times.
Slightly less overhead:
Make a reference chart of your values, and a running total of probability:
C D E
100 5% 0
75 10% 5%
50 42% 15%
30 30% 57%
15 5% 87%
0 8% 92%
Then lookup a 0-1 random number on this chart. =LOOKUP(RAND(),$E$2:$E$7,$C$2:$C$7)
I generated 5224 numbers and produced this pivot chart of the results. Refreshing caused the percentages to waver a bit around the targets, but all attempts looked good.
Row Labels Count Percentage Target
0 421 8.06% 8%
15 262 5.02% 5%
30 1608 30.78% 30%
50 2160 41.35% 42%
75 490 9.38% 10%
100 283 5.42% 5%
Grand Total 5224 100.00%
Or you could do it with two cells and a long if statement:
=RAND()
=IF(A9<0.05,100,IF(A9<0.15,75, ... 0))...
This functionality comes as part of the analysis toolkit add in. You can find this in Excel options -> add ins -> manage add ins.
You want random number generation, and then pick the 'discrete' distribution. The input into this is the table you provided in your post.
"Discrete
Characterized by a value and the associated probability range. The range
must contain two columns: The left column contains values, and the right
column contains probabilities associated with the value in that row. The sum
of the probabilities must be 1."
jsarma's suggestion is also a good one....
You can use vlookup and randbetween.
You'll want to use randbetween. http://office.microsoft.com/en-us/excel-help/randbetween-HP005209230.aspx
vlookup: http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx
Fill one column with consecutive numbers ranging from 1-100.
Fill another column with 5 100's, 10 75's, 42 50's, etc...
Now...
=VLOOKUP(RANDBETWEEN(1,100),A1:B100,2)
There's probably a better way to do this, but I tried this and it seems to work.

Resources