Reputation: 51
Pretty simple questions but i couldn't find out how it works and i've search almost a week for an answer now.
Example:
/ One Number is above 0 and one below
/ Both Numbers are below 0
/ Both Numbers are above 0
So i want to check 3 or 4 things.
Upvotes: 4
Views: 146
Reputation: 21
=IF(AND(A1<0,B1<0),
"below",
IF(AND(A1>=0,B1>=0),
"above",
IF(AND(A1<0,B1>0),
"below and above",
IF(AND(A1>0,B1<0),
"above and below",
""
)
)
)
)
Upvotes: 2
Reputation: 29332
=CHOOSE(1+(B25<0)+(C25<0), "both above", "above and below", "both below")
I used B25
and C25
because from your comment I saw that you want to reference these cells.
If you want to distinguish cases "below and above" from "above and below", use this:
=IF(AND(B25<0,C25<0),"both below", IF(B25<0,"below and above",
IF(C25<0,"above and below","both above")))
p.s.
Your formula (that you posted in the comment) was almost correct but missed some parentheses. It could be fixed like this:
=IF(AND(B25<0,C25<0),"both below",
IF(AND(B25>=0,C25>=0),"both above",
IF(AND(B25<0,C25>=0),"below and above",
IF(AND(B25>=0,C25<0),"above and below"))))
Upvotes: 5
Reputation: 96753
Consider:
=IF(MIN(A1,B1)>0,"above",IF(MAX(A1,B1)<0,"below","above and below"))
This assumes that neither A1 nor B1 will be exactly zero.
Upvotes: 4