+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 : whole and not whole number in if statement

  1. #1
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    whole and not whole number in if statement

    Hi,

    Attached is my sample file. I just can't understand why IF statement can't identify the whole number and not while using the MOD formula.

    Please help me on this.

    Thanks!
    Attached Files Attached Files
    Last edited by darkhangelsk; 01-06-2011 at 11:57 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: whole and not whole number in if statement

    With this part:

    =IF(MOD(E12,1)

    you are saying if MOD(E12) is a number other than 0, than evaluate the TRUE part of the IF... so the MOD(E12,1) is the MOD(18.75,1) which is .75, which is not 0, so TRUE, so then check if B12 (45) is less than 60, which it is, therefore return E12
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: whole and not whole number in if statement

    Not sure of your intentions, but try this

    Please Login or Register  to view this content.

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    Re: whole and not whole number in if statement

    ooooh Marcol, just forgot the ZERO! Thanks, both of you! amazing forum, never fails.

  5. #5
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    Re: whole and not whole number in if statement

    WAITTT!!! I saw another problem. Goshh... I attached it, can't believe i'm still lock on this IF then else statement.
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: whole and not whole number in if statement

    That one is due to precision, probably based on the formula you have in column B using non-whole numbers..

    Try this:

    =IF(MOD(ROUND(E6,2),1)=0,IF(B6<=60,E6,G6),F6)

    copied down, assuming accuracy of 2 decimal places suffices your needs.

  7. #7
    Forum Contributor
    Join Date
    07-20-2009
    Location
    philippines
    MS-Off Ver
    Excel 2007
    Posts
    203

    Re: whole and not whole number in if statement

    Quote Originally Posted by NBVC View Post
    That one is due to precision, probably based on the formula you have in column B using non-whole numbers..

    Try this:

    =IF(MOD(ROUND(E6,2),1)=0,IF(B6<=60,E6,G6),F6)

    copied down, assuming accuracy of 2 decimal places suffices your needs.

    Wow!!! I don't know how did you understand my messy work. I tried several sample and it works. Thank you so much!

+ 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