MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Is there a 'IsInteger' function?


Posted by Thomas Liao on July 17, 2001 11:09 AM

Hi there,
I need a function to distinguish if the result is an integer, something like the 'if' funcion.
How do I write down the code for this IsInteger function?
Example:
If(IsInteger(a1/b1*c1),x,y)

Thank you

Posted by Mark W. on July 17, 2001 11:29 AM

=IF(NOT(MOD(A1/B1*C1,1)),...)

Posted by Aladin Akyurek on July 17, 2001 11:31 AM

Thomas,

There isn't an ISINT function in Excel, but you can embed something like the following in the formulas that you use:

=IF(A1-INT(A1)>0,0,1)

It returns 1 if A1 is an integer. Or a formula that returns a logical value:

=A1-INT(A1)>0

An alternative would be to sollicite for a UDF (user Defined Function) at this board.

Aladin

============