If A1>0 and B1>0 then set C1 to A1

or A1<0 and B1<0 then set C1 to 0

or A1>0 and B1<0 then set C1 to "Not Good"

or A1<0 and B1>0 then set C1 to 0Hopefully someone can help me out on this one!

Example:

A1 B1 C1

1.00 1.00 1.00

-1.00 -1.00 0.00

1.00 -1.00 Not Good

-1.00 1.00 0.00

Try: =IF(AND(A1>0,B1>0),A1,IF(AND(A1<0,B1<0),0,IF(AND(A1>0,B1<0),"Not Good",IF(AND(A1<0,B1>0),0,""))))

MIKE

What happens if either A1 and/or B1 equalzero?If that can never happen, then this shorter version might work for you:

=IF(AND(A1>0,B1>0),A1,IF(AND(A1<0,B1<>0),0,"Not Good"))

By the way...

Mike's suggestion can be shortened since these 2 clauses:

IF(AND(A1<0,B1<0),0

IF(AND(A1<0,B1>0),0can be combined as:

IF(AND(A1<0,B1<>0),0

If B1 is not equal to zero, then it must greater than or less than 0, and since you want 0 in either case, you only need to check it once.

I think...

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

Awesome! Thanks, it worked perfect.

Awesome, it worked perfect. Thanks!

Ask Your Question

Weekly Poll

Do you think ride and car sharing are the future of transportation?

Discuss in The Lounge

Poll History