Spreadsheet Practice

How to check if a number is a whole number in Excel

Formula (Excel and Google Sheets)

=MOD(B2,1)=0

Test whether anything is left after dividing by 1: =MOD(B2,1)=0 returns TRUE for whole numbers.

Result on the example
one result per row in C2, filled down to C6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in C2, filled down to C6. Change any input and the result updates, or edit the formula to experiment.

How it works

MOD(B2,1) is the fraction after the decimal point: 0.5 for 7.5, 0 for 12. Comparing it with 0 gives TRUE for whole numbers. Use it to catch quantities that should be whole units before an order goes out.

=MOD(B2,1)=0

ResultFALSE

  1. B27.5

    The value in B2.

  2. MOD(B2,1)0.5

    MOD: Remainder after division.

    • numberB27.5
    • divisor1
  3. MOD(B2,1)=0FALSE

    The = operator tests whether the two sides are equal.

In Google Sheets

The same formula works in Google Sheets: =MOD(B2,1)=0. We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=B2=INT(B2)FALSE, TRUE, FALSE…A number equals its whole part only if it has no decimals.
=B2=ROUND(B2,0)FALSE, TRUE, FALSE…The same test with ROUND.

Common mistakes

  • Results of calculations can carry tiny binary errors, like 2.9999999999, and test as not whole. Round first: =MOD(ROUND(B2,9),1)=0.
  • Formatting a cell to show no decimals doesn't make the value whole; the test looks at the stored value.

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Check if a number is a whole number

In C2, return TRUE if the quantity is a whole number and FALSE if it has decimals, then fill down to C6.

Questions

How do I stop people entering decimals?

Use Data > Data Validation > Allow: Whole number.

How do I show a label instead of TRUE or FALSE?

Wrap it in IF: =IF(MOD(B2,1)=0,"Whole","Has decimals").

How do I check for a multiple of 6?

=MOD(B2,6)=0.

Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.