Solved If Statement with more than one demand

August 25, 2011 at 08:58:03
Specs: Windows 7
I have an if statement that looks like this:

=IF(R18>Q18,T18*(1+(VLOOKUP(B18,Sheet3!$A$3:$D$25,3,FALSE))),Sheet1!T18*(1+Sheet1!$U$3))

I always want to state that if both R and Q are 0, to this the cell as 0. I am unsure about how to add another if statement, and also unsure about how to make it check if both cells are zero. Any help would be greatly appreciated! Thanks!


See More: If Statement with more than one demand

Report •

#1
August 25, 2011 at 16:39:31
Read up on the AND Function in the Excel Help files:

=IF(AND(R18=0, Q18=0), 0, value_if_false)

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
August 29, 2011 at 08:48:11
Thanks for the help. I put the and statement in, but if R and Q are both zero I need it to do something if R is greater than Q. Can you help me on how I can make a formula like that? I put in:
=IF(AND(R23=0, Q23=0,0, IF(R23>Q23,T23*(1+(VLOOKUP(B23,Sheet3!$A$3:$D$25,3,FALSE))),Sheet1!T23*(1+Sheet1!$U$4))))

but it did not work. Basically I need it to put 0 into the cell if both R and Q are zero, but if they are not both zero, I need it to use the value (R or Q) that is greater. Any help would be great! Thanks :)


Report •

#3
August 29, 2011 at 11:01:40
✔ Best Answer
First, for the AND function to work, you have to close the parenthesis. The 0 result you want needs to be an argument of the IF function, not an argument of the AND as you have it.

This:

=IF(AND(R23=0, Q23=0,0,...

Should be this:

=IF(AND(R23=0, Q23=0),0,...

That allows the AND to be TRUE or FALSE based on the values in R23 and Q23.

This might get you closer, although I have not set up a spreadsheet with all of the variables needed to test it.

=IF(AND(R23=0,Q23=0),0,IF(R23>Q23,T23*(1+(VLOOKUP(B23,Sheet3!$A$3:$D$25,3,FALSE))),Sheet1!T23*(1+Sheet1!$U$4)))

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •
Related Solutions


Ask Question