+ Reply to Thread
Results 1 to 3 of 3

Function that returns boolean value depending on whether a number is an integer

  1. #1
    Registered User
    Join Date
    11-15-2006
    Posts
    1

    Smile Function that returns boolean value depending on whether a number is an integer

    The title sums up basically what I'm looking for. Does anyone know of a function which will return a boolean value depending on whether a number is integer or not? Thanks

    JRT

  2. #2
    Forum Contributor
    Join Date
    07-05-2006
    Location
    Canada
    MS-Off Ver
    2003, 2007
    Posts
    581
    Quote Originally Posted by Jrt
    The title sums up basically what I'm looking for. Does anyone know of a function which will return a boolean value depending on whether a number is integer or not? Thanks

    JRT
    =IF(A1-INT(A1)=0)

    If you find this isn't producing values in every instance (particularly when the value you're checking is the result of calculations):

    =IF(ABS(A1-INT(A1))<10E-8)

    Basically, this formula just checks to see if it's within a really small amount of an integer, which is quite often necessary when you're testing a calculated value.

    Scott

  3. #3
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    alternative, but no better

    =IF(MOD(A1,1)=0,TRUE,FALSE)
    --Mark

    Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1