# 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?

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

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.