I have a retail store that sells items on consignment for a fee that varies based on Selling Price.
So my question is how do I write a formula that checks the selling price and then charges the correct consignment fee to calculate the net based on the following schedule:
When selling price is over $400 then charge = 20%
When Selling price is $100 to $400 then charge = 30%
When Selling price is under $100 then charge = 40%
BLUF: use nested IF statements (an IF inside an IF) --
Example:
=IF(A2>=400, (A2*0.2), (IF(400 > A2 >= 100, (A2 *0.3), (A2*0.4))))
Or use the below if you suspect someone will foolishly enter a negative number or something nonsensical:
=IF(A2>=400, (A2*0.2), (IF(400 > A2 >= 100, (A2 *0.3), (IF(A2 < 100, (A2*0.4), (0))))))
That may look complex, but let's break it down from the beginning.
The basic formula for the IF statement:
=IF(testCondition, (resultIfTrue), (resultIfFalse))
One IF statement will only allow you to do two of your 3 conditions:
=IF(A1 > 400, (A1 * .20), (A1 * .30))
The above basically says that if the number in cell A1 is greater than 400, then the value in your current cell (e.g. B2) is A1 * 20%. But if the number in A1 is NOT greater than 400, the value in your cell will be A1 * 30%.
But how do we calculate the range you were asking (i.e. 100 - 400) and how do we add in a third possibility (i.e. the possibility that the number is less than 100)?
The answer is to use a nested IF. You can tell the cell what it's value should be if the condition is true, but you can test another condition if the answer is false (i.e. the next IF statement stands in the place of resultIfFalse.
=IF(testCondition, (resultIfTrue), (IF(testCondition, (resultIfTrue), (resultIfFalse))))
The above can handle 3 different scenarios. Out of the IFs above, you could also replace the second IFs resultIfFalse with yet another IF statement, and so on. You can nest up to 64 IF statements.
Extra Resources:
http://fiveminutelessons.com/learn-microsoft-excel/using-multiple-if-statements-excel
http://spreadsheets.about.com/od/tipsandfaqs/qt/nested_if.htm
Nested IF functions are not user friendly and require hardcoding your variables (percentages). My suggestion would always be to have a small table of values elsewhere: eg. put the following in A1:B3
0 0.4
100 0.3
401 0.2
Assuming your data is in D1 you can use the following formula in E1 and drag down if necessary
=INDEX($B$1:$B$3,MATCH($D1,$A$1:$A$3,1))
This way you can change your boundaries/ add more conditions easily without more nested IF statements
Try using this instead:
=IF(B1<100,B1*40%,IF((B1>=100)*AND(B1<=400),B1*30%,IF(B1>100,B1*20%,"Invalid Price"))
This formula contains nested-ifs and a logical AND condition which will give the result.
Related
After a bit of advice on doing a calculator with a sliding scale.
I am building a matrix where we have set price points at intervals based on qty of items. The code I use works fine apart from the first 2 ranges.
Because for 1 qty the unit cost is so high my maths won't work.
Example
Qty 1 = £23.25 (Price per unit is then £23.25)
Qty 10 = £51.59 (Price per unit is then £5.159)
I then have further quantity's that work out correctly.
What I need to be able to do is some sort of weighted value, for 2 off the unit price needs to be near the £20 a unit mark, then 3 off less etc until I get to 10 off # £5.159 a unit.
(It costs more for lesser quantity's, we want to encourage more qty)
Has anyone implemented something like this? From 10 qty onwards the calculation is fine as the unit cost changes are not much at all.
Thanks
Assuming you have quantities form 1 to 10, in column A, put 23.25 in B1 and 51.59 in B10, then the following formula in B2:
=B1+(B$10-B$1)/9
And populate down to B9
in C1 use the following formula:
=B1/A1
and populate down. Final result should look like this:
You could use vlookup with a table as so:
I made a small workbook that exactly mimics the original formulas I posted. The purpose of the workbook is to calculate the bonuses for each employee based on various inputted combinations (listed below). Here is how my workbook is laid out:
Data Tab
Bonus Tab
Base Bonus Tab
Summary Tab
Picture of the Data tab that I utilize to input the different combinations:
Data Tab
List of the combinations:
Employee % (cell B3) & Company % (cell B4) cells have numbers inputted = Combo 1 (range: 0%-100%)
Employee $ (cell B5) & Company $ (cell B6) cells have numbers inputted =Combo 2 (range: $0-no limit)
Base Salary (B2) is Yes & Employee % (cell B3) cells have been inputted = Combo 3 (Base Salary is either Yes or blank)
Base Salary (B2) is Yes & Job Title (A8) & Employee % (cell B8) cell have been inputted = Combo 5
I use cell C1 for an IF statement to dictate which formula to use based on the combinations above. (ex. numbers in B5 & B6 = 1)
=IF(AND($B$2<>"",$A$8<>"",$B$8<>""),5,IF(AND($B$2<>"",$B$3<>""),3,IF($B$3<>"",1,IF($B$5<>"",2))))
Picture of the Bonus Tab: Bonus Tab
Picture of the Base Bonus Tab: Base Bonus Tab
Picture of the Summary Tab: Summary Tab
I have created formulas for each combinations separately, but as soon as I try to combine them into one, I get the Too many arguments error message since combo 3 & combo 5 use false within the IF statement. I am attempting to avoid making a calculations table and would prefer utilizing one formula on the summary tab by employee in column B.
I will further explain combo 3 specifically - If the base bonus is less than the regular bonus, than multiply the base bonus * Employee % + Company&Vendor bonus * Company %. If base bonus is more than regular bonus, than multiply regular bonus * Employee % + Company&Vendor bonus * Company %.
Example:
Bobby
Base Bonus $50 < Regular Bonus $100
$50 * 50% employee % = $25
+ $200 company + $0 vendor * 50% company = $100
Final answer is $125 if base bonus if < regular bonus
I will further explain combo 5 specifically - If the base bonus is less than the regular bonus, than multiply the base bonus * employees job title Employee % + Company&Vendor bonus * job title Company %. If base bonus is more than regular bonus, than multiply regular bonus * employees job title Employee % + Company&Vendor bonus * job title Company %.
Example:
Bobby
Base Bonus $50 < Regular Bonus $100
Find Bobby's Job title to determine Employee % & Company %
75% Employee % for Officers and 50% Company %
75% * $50 + 50% * ($200 Company & $0 Vendor) = $137.5
Final answer is $137.5 of base bonus if < regular bonus
Here is list of each formula by combo:
Combo 1:
=IF(Data!$C$1=1,Data!$B$3*Bonus!D2+Data!$B$4*(Bonus!E2+Bonus!F2))
Combo 2:
=IF(Data!$C$1=2,IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$6+Data!B5))
Combo 3:
=IF(Data!$C$1=3,IF(VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)<VLOOKUP(Summary!A2,Bonus!$A$2:$D$5,4,FALSE),VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)*Data!$B$3+Data!$B$4*(Bonus!E2+Bonus!F2),VLOOKUP(A2,Bonus!$A$2:$D$5,4,FALSE)*Data!$B$3+Data!$B$4*(Bonus!E2+Bonus!F2)))
Combo 5:
IF(Data!$C$1=5,IF(VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)<VLOOKUP(Summary!A2,Bonus!$A$2:$D$5,4,FALSE),VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,2,FALSE)+(Bonus!E2+Bonus!E2)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,3,FALSE),VLOOKUP(A2,Bonus!$A$2:$D$5,4,FALSE)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,2,FALSE)+(Bonus!E2+Bonus!E2)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,3,FALSE)))
Hopefully this is a lot more clear than my initial post and can easily be replicated. Let me know if you have any questions, Thank you!
I found some issues in your formulas
Combo3 In the else option you have A2 following the pattern it should be Summary!A2
Combo5 the sum is in the same cell you have (Bonus!E2+Bonus!E2) it should be (Bonus!E2+Bonus!F2)
I didn't record the initial nested If to compare why it is not working. I got this:
Final Nested:
=IF(Data!$C$1=1,Data!$B$3*Bonus!D2+Data!$B$4*(Bonus!E2+Bonus!F2),IF(Data!$C$1=2,IF(SUM(Bonus!B2:C2)<1,0,1)*Data!$B$6+Data!B5,IF(Data!$C$1=3,IF(VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)<VLOOKUP(Summary!A2,Bonus!$A$2:$D$5,4,FALSE),VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)*Data!$B$3+Data!$B$4*(Bonus!E2+Bonus!F2),VLOOKUP(Summary!A2,Bonus!$A$2:$D$5,4,FALSE)*Data!$B$3+Data!$B$4*(Bonus!E2+Bonus!F2)),IF(VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)<VLOOKUP(Summary!A2,Bonus!$A$2:$D$5,4,FALSE),VLOOKUP(Summary!A2,'Base Bonus'!$A$2:$B$5,2,FALSE)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,2,FALSE)+(Bonus!E2+Bonus!F2)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,3,FALSE),VLOOKUP(B2,Bonus!$A$2:$D$5,4,FALSE)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,2,FALSE)+(Bonus!E2+Bonus!F2)*VLOOKUP(VLOOKUP(Summary!A2,Data!$A$16:$B$19,2,FALSE),Data!$A$8:$C$11,3,FALSE)))))
I have this table in Excel:
I am trying to get weighted sum depending on two conditions:
Whether it is Company 1 or Company 2 (shares quantity differ)
Whether column A (Company 1) and column B (Company 2) has 0 or 1 (multipliers differ)
Example:
Lets calculate weighted sum for row 2:
Sum = 2 (multiplier 1) * 50 (1 share price) * 3 (shares quantity for Company 1) +
+0.5 (multiplier 0) * 50 (1 share price) * 6 (shares quantity for Company 2) = 450
So, Sum for Row 2 = 450.
For now I am checking only for multipliers (1 or 0) using this code:
=COUNTIF(A2:B2,0)*$B$9*$B$8 + COUNTIF(A2:B2,1)*$B$9*$B$7
But it does not take into account the shares quantities for Company 1 or Company 2. I only multiply 1 share price with multipliers, but not with shares quantity).
How can I also check whether it is Company 1 or Company 2 in order to multiply by corresponding Shares quantity?
Upd:
Rasmus0607 gave a solution when there are only two companies:
=$B$9*$E$8*IF(A2=1;$B$7;$B$8)+$B$9*$E$9*IF(B2=1;$B$7;$B$8)
Tom Sharpe gave a more general solution (number of companies can be greater than 2)
I uploaded my Excel file to DropBox:
Excel file
I can offer a more general way of doing it with the benefit of hindsight that you can apply to more than two columns by altering the second CHOOSE statement:-
=SUM(CHOOSE(2-A2:B2,$B$7,$B$8)*CHOOSE(COLUMN(A:B),$E$8,$E$9))*$B$9
Unfortunately it's an array formula that you have to enter with CtrlShiftEnter. But it's a moot point whether or not it would be better just to use one of the other answers with some repetition and keep it simple.
You could also try this:-
=SUMPRODUCT(N(OFFSET($B$6,2-A2:B2,0)),N(OFFSET($E$7,COLUMN(A:B),0)))*$B$9
Here's how it would be for three companies
=SUM(CHOOSE(2-A2:C2,$B$7,$B$8)*CHOOSE(COLUMN(A:C),$F$8,$F$9,$F$10))*$B$9
(array formula) or
=SUMPRODUCT(N(OFFSET($B$6,2-A2:C2,0)),N(OFFSET($F$7,COLUMN(A:C),0)))*$B$9
=$B$9*$E$8*IF(A2=1;$B$7;$B$8)+$B$9*$E$9*IF(B2=1;$B$7;$B$8)
Since in the COUNTIF function, you don't know beforehand, which company column contains a 0, or a 1, I would suggest a longer, but more systematic solution using IF:
=$B$9*$E$8*IF(A2=1;2;0,5)+$B$9*$E$9*IF(B2=1;2;0,5)
This is a bit less general, but should produce the result you expect in this case.
I am having trouble determining the correct way to calculate a final rank order for four categories. Each of the four metrics make up a higher group. A Top 10 of each category is applied to the respective product to risk analysis.
CURRENT LOGIC - Assignment of 25% max per category.
Columns - Y4
Parts
0.25
25
=IF(L9=1,$Y$4,IF(L9=2,$Y$4*0.9, IF(L9=3,$Y$4*0.8, IF(L9=4,$Y$4*0.7, IF(L9=5,$Y$4*0.6, IF(L9=6,$Y$4*0.5, IF(L9=7,$Y$4*0.4, IF(L9=8,$Y$4*0.3, IF(L9=9,$Y$4*0.2, IF(L9=10,$Y$4*0.1,0))))))))))
DESIRED...
I would like to use a statement to determine three criteria in order to apply a score (1=100, 2=90, 3=80, etc..).
SUM the rank positions of each of the four categories-apply product rank ascending (not including NULL since it's not in the Top 10)
IF a product is identified in more than one metric-apply a significant contribution weight of (*.75),
IF a product has the number 1 rank in any of the four metrics-apply a score of (100).
Data - UPDATED EXAMPLE
(Product) Parts Labor Overhead External Final Score
"XYZ" 3 1 7 7 100
"ABC" NULL 6 NULL 2 100
"LMN" 4 NULL NULL NULL 70
This is way beyond my capability. ANY assistance is appreciated greatly!!!
Jim
I figured this is a good start and I can alter the weight as needed to reflect the reality of the situation.
=AVERAGE(G28:I28)+SUM(G28:I28)*0.25
However, I couldn't figure out how to put a cap on the score of no more than 100 points.
I am still unclear of what exactly you are attempting and if this will work, but how about this simple matrix using an array formula and some conditional formatting.
Array Formula in F2 (make sure to press Ctrl+Shift+Enter when exiting formula edit mode)
=MIN(100,SUM(IF(B2:E2<>"NULL",CHOOSE(B2:E2,100,90,80,70,60,50,40,30,20,10))))
Conditional Formatting defined as shown below.
Red = 100 value where it comes from a 1
Yellow = 100 value where it comes from more than 1 factor, but without a 1.
I live abroad and I want to send some money back home. The bank will only let me send it in the local currency or 12 other currencies, and mine is not on their list. Therefore I only have the option of sending the local currency, which is Japanese Yen, or Euros. I want to create a spreadsheet, showing me when it would be worth sending in Euros and when it would be worth it sending in Yen. So I have:
Option 1: Send Euros
Option 2: Send Yen
Option 1 will require:
2,000 Yen handling fee
Two currency exchange transactions (Yen ---> Euros ---> Swedish Kroner)
Option 2 will require:
2,000 Yen handling fee + 0.1% of amount (minimum 1,500 Yen)
One currency transaction (Yen ---> Swedish Kroner)
So I made the following spreadsheet:
Exchange Rate
JPY/EUR: 143.21
EUR/SEK: 8.209
JPY/SEK: 0.058065
Handling Fee
EURO: 2000
JPY: 3500
Amount: 300,000
Option 1: 17081.782
Option 2: 17216.273
Amount X: ???
Here the Amount is set to 300,000 Yen
Option 1 is:
((300,000 - 2,000) / 143.21) * 8.209
((Amount - Handling) / JPY/EUR) * EUR/SEK
Option 2 is:
(300,000 - 3,500) * 0.058065
(Amount - Handling) * JPY/SEK
(Handling fee in Option 2 is 2,000 + 0.1% of amount, but minimum 1,500, and since 0.1% of 300,000 is 300, it will always be 1,500 for smaller amounts like 300,000.)
What I want to find out is Amount X, which is the amount where Option 1 - Option 2 = 0.
Does anyone have any suggestions to how I can obtain Amount X through a formula in Excel so that I will always be given the minimal amount I need to send before Option 1 is better than Option 2.
With a layout as below and suitable formulae which you clearly can manage, the results in C9 are 17,081.78 kr and in E10 17,216.27 kr. The balance point is when D2 is ¥119,132.
This can be achieved with algebra by solving for when:
=B9*(D2-D3)/B8
equals:
=B10*(D2-D3-MAX(1500,E2*0.001))
but since the fixed handling fee is common to both options it is slightly easier to calculate the D4 'break-even' value and then add ¥2,000 to it. This would be:
=E5/(1-B9/(B8*B10))
Where, as you suggested, E5 might as well be replaced by 1500. However to spare the algebra involved in solving for D4 Excel has a feature to help. With the first formula above say in G2 and the second in H2 then in I2:
=G2-H2
is Option1 - Option2 which is -134.49 where D2 is ¥300,000. You want this to be 0, so go to DATA > Data Tools - What-If Analysis, Goal Seek..., and Set cell: I2, to value: 0, By changing cell: D2, OK. Excel will then apply a lot of sensible guesswork and in this case should find the answer, which will show in D2 if you click OK again.