Curious if() result

I have a formula that has started to produce nonsense results:

=IF(E5<>E8,"ERROR","OK")

To check I tried the inverse:

=IF(E5=E8, "OK", "ERROR")

But it still reports ERROR when E5 and E8 are the same value.
Here is a screenshot of the Function Wizard showing a forumula result of ERROR when both values are the same.

The formula is a monthly check. Sheets for Jan to Aug report right, but can I get Sep to work?

I must be blind to something obvious, but cannot see it :face_with_spiral_eyes:, sorry.

Try
=E5=E8
The result might be FALSE, so E5 is not exactly equal to E8.
=ROUND(E5;2)=ROUND(E8;2) might be TRUE or
=ROUND(E5-E8;2)=0

1 Like


 OR the types are different (Text vs. Number; bad horizontal alignment).
Such things can never be decided based on a screenshot. Attach the real thing.

Background info:

@Lupp Thank you for the advice. I see was misled by simpler appearance, not the same thing when detail is important.

Thanks @Villeroy. Thirty years ago, I knew that :face_with_open_eyes_and_hand_over_mouth: but it fell through the seive. Now I’ve struggled with an example
 :laughing:

=if(or(a1<a2;a2<a1);“not equal“;“equal“)


 would only “help” in case when the cells contain different data types, relying on automatic conversion in the comparison operators subject to calculation settings under Options|Calc|Formula (and locale settings, defining if the string could convert to number or not), which makes this answer unreliable.

If one wants to only resolve the data type mismatch (without making a better change making sure to use correct data types in the first place, and without any approximate equality), it’s better to use VALUE (or maybe even better NUMBERVALUE, if you need to control locale-specific conversion) explicitly:

=IF(VALUE(A1)=VALUE(A2);"equal";"not equal")

Thankyou @mikekaganski , I didn’t know of these. Very useful.

Ah, explicitly avoid minute rounding errors. Thank you @KoJoT