Validate a whole number in Excel

Very INTeresting

If you need to confirm a number is a whole number you can use a function with a short name.

The INT function (it is short for INTEGER) which will remove any decimals from a number. INTEGER is a mathematical and programming term for a whole number.

If cell A1 has a number and you want to validate it as a whole number you could use.

=A1=INT(A1)

This will display TRUE if the number is a whole number and FALSE if it isn’t.

If you aren’t sure the cell will hold a number and it might hold text or even an error you can use.

=IF(ISNUMBER(A1),A1=INT(A1))

This will display FALSE for text and avoid the #VALUE! error.

Note: The IF function doesn’t have a FALSE argument and so it will simply display FALSE if the ISNUMBER function returns FALSE.

This formula also handles errors in cell A1.

Some examples shown below.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

3 thoughts on “Validate a whole number in Excel

  1. This provides a false positive for negative numbers which are not whole numbers. The function does not work.