IF/AND worksheet function

F

Fan924

How do I word a worksheet function where both of these is true,
IF C18=C20 AND IF C18=C16
gives a 1, not it gives a 0
 
J

Jacob Skaria

AND is be used as below..all the conditions inside braces ()
=IF(AND(C18=C20,C18=C16),1,0)

Here even if these cells are blank; it will return 1. If you want to avoid
this add one more condition within AND...
=IF(AND(C18<>"",C18=C20,C18=C16),1,0)

If this post helps click Yes
 
F

Fan924

Thanks, works great.
How about something more complex? I get an error with all I try

IF(AND(C10=C12,C10=C8),1,0) OR IF(AND(C10=C12,C10=C14),1,""),1,0)
returns a 1 of 0
 
J

Jacob Skaria

Try the below...The new condition is again within the same IF

=IF(OR(AND(C10=C12,C10=C14),AND(C10=C12,C10=C8)),1,0)

OR

=IF(AND(C10=C12,OR(C10=C14,C10=C8)),1,0)


If this post helps click Yes
 
Top