cfrake
asked on
IF statement using AND in Excel 2010
I am very frustrated with the syntax needed in Excel 2010 to perform a simple IF AND statement. The following formula works flawlessly if K4>0.
=IF(K4>0,(O27 + (E13/2) + E25),(O27 + (E13/2) + E25 + P2))
I need to add the logic to make the final result be 0 if K4 =0.
Any and all help will be greatly appreciated.
=IF(K4>0,(O27 + (E13/2) + E25),(O27 + (E13/2) + E25 + P2))
I need to add the logic to make the final result be 0 if K4 =0.
Any and all help will be greatly appreciated.
ASKER
Thank You,
I think my question was poorly presented.
The AND has to do with if P2 is added or not and is based on another cell (N4).
Pseudo code:
If K4 >0 AND N4<3 Then (O27 + (E13/2) + E25)
ELSE IF K4>0 AND N4=3 then (O27 + (E13/2) + E25 + P2
ELSE 0.
All cells other than K4 are always populated and the original formula is good unless K4=0.
Because all other cells are populated the result is always greater than 0.
If K4=0 the end result needs to be 0.
Thank you again for the response and i hope that clarifies the question.
I think my question was poorly presented.
The AND has to do with if P2 is added or not and is based on another cell (N4).
Pseudo code:
If K4 >0 AND N4<3 Then (O27 + (E13/2) + E25)
ELSE IF K4>0 AND N4=3 then (O27 + (E13/2) + E25 + P2
ELSE 0.
All cells other than K4 are always populated and the original formula is good unless K4=0.
Because all other cells are populated the result is always greater than 0.
If K4=0 the end result needs to be 0.
Thank you again for the response and i hope that clarifies the question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
try this.
=IF(K4>0, IF(N4<= 3, O27 + (E13/2) + E25,0) + IF(N4=3,P2,0),0)
=IF(K4>0, IF(N4<= 3, O27 + (E13/2) + E25,0) + IF(N4=3,P2,0),0)
Probably this one
=if(k4=0,0,if(and(k4>0,n4< 3),O27+(E1 3/2)+E25,i f(and(k4>0 ,n4=3),O27 +(E13/2)+E 25+p2,0)))
Note that if k4 >0 and n4>3 it will also return 0.
=if(k4=0,0,if(and(k4>0,n4<
Note that if k4 >0 and n4>3 it will also return 0.
ASKER
PERFECT!!
I will have to tweak some cell references finish up the project now but you have provided me with the syntax required.
I cannot thank you enough.
I wish I would have posted this question here before wasting all that time hammering at it on my own.
Thank you,
I will have to tweak some cell references finish up the project now but you have provided me with the syntax required.
I cannot thank you enough.
I wish I would have posted this question here before wasting all that time hammering at it on my own.
Thank you,
=IF(K4>0,(O27 + (E13/2) + E25), IF(K4=0, 0,(O27 + (E13/2) + E25 + P2)))
and
=IF(K4>0,O27 + (E13/2) + E25,IF(K4=0, 0,O27 + (E13/2) + E25 + P2))
might do it as well. I've taken out brackets that may not be necessary.