+ Reply to Thread
Results 1 to 5 of 5

If statement using time

  1. #1
    Registered User
    Join Date
    01-10-2018
    Location
    Scotland
    MS-Off Ver
    Office 2013
    Posts
    16

    If statement using time

    Hi

    Can anyone help me with this IF statement?

    In cell I3 I have summed hours from a range of cells (this has been formatted [h]mm )

    In cell J3 I want it to say Y if the hours are greater than 20 in I3
    In cell K3 I want it to say Y if the hours are greater than 50 in I3

    I have used the statement =IF($I3>=TIMEVALUE("20:00"),"Y",""), in cell J3 which seems to work but when I use the statement =IF($I$3>=TIMEVALUE("50:00"),"Y","") in K3, it isn't working.
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,907

    Re: If statement using time

    Timevalue cannot exceed 23:59:59. Any value greater will spill over into next day and gets truncated.

    You can simply use... 20/24, 50/24 instead.
    In Excel, 1 = 1 day = 24 hours. So Hour Value / 24 gives time value of hour.

    Ex: =IF($I$3>=50/24,"Y","")
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Contributor
    Join Date
    11-10-2017
    Location
    INDIA
    MS-Off Ver
    365
    Posts
    184

    Re: If statement using time

    HI, Try the below:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    How I reached to 0.8333, simple just convert the time to number, and use the equivalent number in formula.
    *If you wish you click on *,a way to say ThankYou

  4. #4
    Registered User
    Join Date
    01-10-2018
    Location
    Scotland
    MS-Off Ver
    Office 2013
    Posts
    16

    Re: If statement using time

    Brilliant - thank you both so much.

  5. #5
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: If statement using time

    Quote Originally Posted by j9mcl View Post
    Brilliant - thank you both so much.
    But I hope you recognized CK76's response as correct and Sunny18pc's response as incorrect.

    In general, it is unwise to replace an exact calculation like 20/24 and 50/24 with their decimal equivalents (e.g. 0.833333333333333 for 20/54).

    But 0.8333, in particular, is a poor estimate of 20/24. In fact, if you format 0.8333 as [h]:mm, you will see 19:59 instead of 20:00, because 0.8333 is really about 19:59:57.120, and Excel does not round to the minute when the format is [h]:mm .

    Moreover, of course, Sunny18pc's response does not directly address the critical part of your question, namely how to handle 50 hours. Following his paradigm, you would use I3 >= 2.08333333333333.

    But again, CK76's paradigm -- I3 >= 50/24 -- is more correct.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. IF STATEMENT with time.
    By itshere in forum Excel General
    Replies: 21
    Last Post: 12-29-2016, 03:13 PM
  2. IF statement involving time subtraction versus entered time data
    By JasonTran in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-08-2016, 11:43 AM
  3. [SOLVED] IF statement on data validation, End time greater than Start time
    By Faridwahidi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-02-2014, 08:04 AM
  4. Replies: 4
    Last Post: 03-14-2014, 07:08 AM
  5. If statement to determine if time value is higher than another time value
    By xtort81 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-15-2013, 03:48 PM
  6. If Statement for time
    By wtangow in forum Excel General
    Replies: 3
    Last Post: 11-15-2011, 11:38 AM
  7. Time IF statement
    By Mugen_DC5 in forum Excel General
    Replies: 3
    Last Post: 01-20-2009, 05:53 PM

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