Share via

excel spreadsheet does not compare numbers properly

Anonymous
2018-02-24T05:58:56+00:00

Load the spreadsheet from Google Drive

https://drive.google.com/file/d/1WkDA9wTLJSsbt2TwM984mddIWhf-4fzf/view?usp=sharing

The formula that won't behave properly is at "THIS IS THE FORMULA THAT WON'T BEHAVE"

The formula is simply comparing a calculated  value of 0.01 to a CONSTANT defined as 0.01.

Both cells are defined as NUMBER with 2 decimal places.

It misbehaves whether I use the CONSTANT or just hard-code the 0.01 value within the formula.

This is pretty basic stuff. Perhaps I inadvertantly changed some option?

Thanks in advance for your help.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Vijay A. Verma 104.9K Reputation points Volunteer Moderator
2018-02-24T06:26:39+00:00

Right click on H34 > Format Cells > Increase the Decimals to 20

Now you will see that the value is not 0.01 but 0.00999999.....

That is the reason why it is not matching with 0.01

This is not your issue. This is called Floating Point Error (happens with all IT Systems)

Refer to following. The solution as described in second link is to use ROUND function.

http://support.microsoft.com/kb/78113/en-us

http://blogs.office.com/2008/04/10/understandin...

Hence, you will need to use following formula

=IF(ROUND(H34,2)=J26,"OK","?")

Was this answer helpful?

3 people found this answer helpful.
0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2018-02-24T09:42:13+00:00

    Yours and Jason's answers were both helpful. The article you referred to was quite informative. Since one is not able to mark more than one post as the answer, I've marked both as helpful and marked yours as the answer.

    Thanks for you help

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2018-02-24T09:34:40+00:00

    Yours and E for Excel's answers were both helpful. The article E for Excel referred to was quite informative. Since one is not able to mark more than one post as the answer, I've marked both as helpful and marked E for Excel's as the answer.

    Thanks for you help.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2018-02-24T06:27:35+00:00

    The answer provided here should help you:

    https://answers.microsoft.com/en-us/msoffice/fo...

    Was this answer helpful?

    0 comments No comments