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!

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.

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 :)

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.

Ask Your Question

Weekly Poll