+ Reply to Thread
Results 1 to 5 of 5

if function not returning value when in time format

  1. #1
    Registered User
    Join Date
    02-24-2012
    Location
    florida
    MS-Off Ver
    Excel 2010
    Posts
    97

    if function not returning value when in time format

    hello all,

    i am working on a spreadsheet that deals with times such as a work schedule, how every the schedule cells are in a time format, and my if function will only return "check"(which is false). my code works if it remove the time formatted cells but i want to keep the document in its orginal format.

    =IF(Mngmt!F16="PH","",IF(Mngmt!F16="OFF ","",IF(Mngmt!F16="VAC ","",IF(Mngmt!F16="8:00:00 AM", "MIKE", "CHECK"))))

    the bold and under line portion is where my problem is at.

    its looking to the mngmt tab to find f16 when it equal 8:00:00 AM (scheduled time in time format) but returns ""check"(false)

    thanks for your help in advance.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    "8:00:00 AM" is a string so won't match a time value which is numeric.

    Try wrapping it in DATEVALUE.

    DATEVALUE("8:00:00 AM")
    If posting code please use code tags, see here.

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: if function not returning value when in time format

    Hi HPIMICHAEL02

    It is because you are entering the time in text format, change the formula part "8:00:00 AM" to

    TIME(8,0,0)

    or

    0.333333333333333

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Registered User
    Join Date
    02-24-2012
    Location
    florida
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: if function not returning value when in time format

    thanks so much , i have been think about this for an hour, both worked like a charm. thanks again.

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: if function not returning value when in time format

    You are welcome...

    Cheers

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

+ 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