All, I am new to this forum, and Excel and am hoping that someone can provide some guidance on my below query.
I am attempting to use a nested IF statement to deliver a reslt based on multiple conditions. The first 2 IF statements deliver the correct result, however the third IF statement produces a #VALUE! message. Having played with the syntax for a number of hours I am no where nearer to uncovering the error.
=IF(B22<=5,B22*B17,IF(B22<=10,(5*B17)+(B22-5)*C17)),IF(B22<=15,((5*B17)+(5*C17)+(B22-10))*D17)
Attached is a screenshot that displays what I am attempting.
Any assistance would be greatly appreciated.
Best regards
maybe
=IF(B22<=5,B22*B17,IF(B22<=10,((5*B17)+(B22-5))*C17,IF(B22<=15,((5*B17)+(5*C17)+(B22-10))*D17,"something")))
fyi its easier to check if you split it into its components
=IF(B22<=5,B22*B17,
IF(B22<=10,(5*B17)+(B22-5)*C17)),
IF(B22<=15,((5*B17)+(5*C17)+(B22-10))*D17
then you can see
IF(B22<=10,(5*B17)+(B22-5)*C17)), is not quite right
it needs to be IF(B22<=10,(5*B17)+(B22-5)*C17,
or perhaps
IF(B22<=10,((5*B17)+(B22-5))*C17),
but i dont know which you actually want
also you have not specified what to do if all 3 conditions not met
Last edited by martindwilson; 07-29-2010 at 06:49 AM.
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Instead of a screenshot, you should have posted the Excel sheet (replace confidential info with dummy data)
counting the brackets in your formula, I think you are closing some IFs too early. Try
Your last nested if does not have a statement for False. You may want to do something about that.=IF(B22<=5,B22*B17,IF(B22<=10,(5*B17)+(B22-5)*C17,IF(B22<=15,((5*B17)+(5*C17)+(B22-10))*D17)))
ah, Martin, you in the morning, me at night, but the same gist!
The parentheses are still out of kilter if this is a tiered calculation - only B22-10 should be multiplied by D17.
If preferred you can conduct tiered commission calcs with SUMPRODUCT - see: http://www.mcgimpsey.com/excel/variablerate.html
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
For sake of SUMPRODUCT example - see attached
(add cap if nec.)
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
hmm run before walk springs to mind!
"Unless otherwise stated all my comments are directed at OP"
Mojito connoisseur and a dabbler in Cisco
where does code go ?
look here
how to insert code
how to enter array formula
why use -- in sumproduct
recommended reading
wiki Mojito
how to say no convincingly
most important thing you need
Martin Wilson: SPV
and RSMBC
Perhaps though personally I would argue that when it comes to tiered calculations the SUMPRODUCT approach is generally the simplest to manage and adapt long term.
The greater the number of tiers the more sense it makes to use SUMPRODUCT.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks