# Issues with 'If' statement - excel

Not sure my logic is correct with this, but I thought i would give it a go. I have used an IF OR statement and then on the true variable embedded an IF AND statement. Within the attached spreadsheet, cells D13 and D14 I check 1st for validity - in the example I have given, the values fall within the true range so should then calculate the exponential - this is not happening. In cell G16 I have checked what I believe the output should be for the below. Within the worksheet I have embedded an image of the calculations I am trying to automate. i decided to start with those circled in red with 1 and then check 2....

=IF(OR(D13<-1.5,D14>2),0,IF(AND(-1.5<=D13<=0,0<=D14<=2),D16*EXP(D17*D13),0))

co.xlsx
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Try
=IF(AND(D13>=-1.5, D13<=0,D14<=2, D14 >0),D16*EXP(D17*D13),0)
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Excellent. Just done some validation checks - I understand your variables but don't understand how you can embed 4 variables. You have managed to remove the OR variable?
0
Commented:
Now you have 2 cases:
1. AND: -1.5 <= D13 <=0, 0 < D14 <= 2          - calculate S
2. All other cases                                              - S = 0
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.