Share via

if statement: Why does my if statement that compares two numbers indicate the two numbers are not equal when in fact they are equal?

Anonymous
2024-09-30T11:58:14+00:00

if statement: Why does my if statement that compares two numbers indicate the two numbers are not equal when in fact they are equal?

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

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-09-30T13:51:43+00:00

    Share a view-only link to an Excel file that demonstrates the problem. Upload the file to a file-sharing website such as box.net/files, dropbox.com, onedrive.live.com, etc.

    There are several possible explanations.

    1. One "number" might actually be text. Looks can be deceiving, and the format of the cell does not matter. Use formulas of the form =ISTEXT(A1) or =ISNUMBER(A1) to confirm.
    2. Two numbers might appear to be equal due to cell formatting, but they differ if you look at their full precision. Use formulas of the form =A1&"" to view the first 15 significant digits of both values.
    3. Two numbers might appear to be equal up to their first 15 significant digits, which is the most precision that Excel formats. But in fact, their internal binary values differ infinitesimally due to precision that Excel does not format.

    This is why a simple screenshot might not be sufficient, and we need to work with the Excel file directly.

    Was this answer helpful?

    0 comments No comments