Formula to check for whole number

Loreigh

New Member
Joined
Apr 11, 2007
Messages
9
I need a formula that will check to see if the number is cell A1 is a whole number and return TRUE if it is. I cant seem to find anything that does it. I dont want the number to round, I just need to know if it is a whole number.

Any suggestions?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hello,

Try the following:

Code:
=MOD(A1,1)=0

Another way:

Code:
=INT(A1)=A1
Etc... ;)

Hope this helps. :)
 
Upvote 0
I haven't tried this, but is should do what you want

=int(A1)=A1. Note that it will return true if the cell is blank also.
 
Upvote 0
Note that it will return true if the cell is blank also.
True.

You could test the cell's Value's length via Len(), e.g.,

Code:
=IF(LEN(A1),MOD(A1,1)=0,"")
To ignore an Empty cell. :)
 
Upvote 0
I used conditional formatting to show something as a % if it was a whole number, if it wasn't a whole number then it was a fraction and I wanted it to show a fraction to simplify things for the intended audience. I think this will work to check for a whole number for your needs. X/rounded(X,0)=whole number because it will equal 1. Anything else is not a whole number.

=IF(P45/ROUND(P45,0)=1,TRUE,FALSE)
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top