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

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
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,215,132
Messages
6,123,227
Members
449,091
Latest member
jeremy_bp001

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