+ Reply to Thread
Results 1 to 8 of 8

Recording and Monitering Times

Hybrid View

  1. #1
    Registered User
    Join Date
    02-01-2015
    Location
    United Kingdom
    MS-Off Ver
    2007
    Posts
    3

    Recording and Monitering Times

    So I moniter closing times, however im having an issue with times of closing around midnight.

    For example the actual closing time of a store should be 00:00. if it closes early before midnight the formula doesnt work. Can anyone help. I get this

    Cell D21 is Scheduled closing of 00:00
    Cell D22 is Recorded actual closing time of 22:56
    Cell D23 is variance in mins =IF(D22=0,0,(D22-D21)*1440)

    Can anyone help as it works for all other times?

    Cheers
    Ross

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Recording and Monitering Times

    Try this instead:

    Formula: copy to clipboard
    =IF(HOUR(E21)<12,HOUR(E21)*60+MINUTE(E21),1440-HOUR(E21)*60+MINUTE(E21))
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    02-01-2015
    Location
    United Kingdom
    MS-Off Ver
    2007
    Posts
    3

    Re: Recording and Monitering Times

    Quote Originally Posted by mehmetcik View Post
    Try this instead:

    Formula: copy to clipboard
    =IF(HOUR(E21)<12,HOUR(E21)*60+MINUTE(E21),1440-HOUR(E21)*60+MINUTE(E21))
    Thank you for this im slightly confused by the E21 cell. I realize this is just an example but I can't seem to figure out the right way to apply it

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: Recording and Monitering Times

    Excel thinks that D22 is later than D21 22 hours 56 mins

    Let says if early closing hour is around 12PM to 23:59 PM previous day, late closing hour around 00:00 AM to 11:59AM next day

    D23:

    =IF(HOUR(D22)<12,D22-D21,"-"&TEXT(D21+1-D22,"hh:mm"))
    Quang PT

  5. #5
    Registered User
    Join Date
    02-01-2015
    Location
    United Kingdom
    MS-Off Ver
    2007
    Posts
    3

    Re: Recording and Monitering Times

    Quote Originally Posted by bebo021999 View Post
    Excel thinks that D22 is later than D21 22 hours 56 mins

    Let says if early closing hour is around 12PM to 23:59 PM previous day, late closing hour around 00:00 AM to 11:59AM next day

    D23:

    =IF(HOUR(D22)<12,D22-D21,"-"&TEXT(D21+1-D22,"hh:mm"))
    Hi THere,

    Thanks for replying. However I should have said I need to calculate the amount of time in minutes that the store is early/late?

    So if it closes 30 mins early -30
    Closes 30 mins late +30

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

    Re: Recording and Monitering Times

    Quote Originally Posted by rossb1992 View Post
    So I moniter closing times, however im having an issue with times of closing around midnight. For example the actual closing time of a store should be 00:00. if it closes early before midnight the formula doesnt work.
    [....]
    Cell D21 is Scheduled closing of 00:00
    Cell D22 is Recorded actual closing time of 22:56
    Cell D23 is variance in mins =IF(D22=0,0,(D22-D21)*1440)
    You have an unresolvable ambiguity in your notation. If the actual closing time were 00:04, the formula would work. The point is: how can we (and Excel) know whether 00:00 is the midnight before or the midnight after the actual closing time?

    Best solution: record the date with the time. Note that midnight is actually the beginning of the next day. So if today is Feb 1, closing time at midnight "today" is actually 00:00 on Feb 2.

    PS.... Even though you include the date, you can hide it by formatting the cell as Custom hh:mm , if you prefer.

    Then the difference in minutes is simply:

    =ROUND((D22-D21)*1440,0)

    I use ROUND(...,0) to eliminate binary arithmetic anomalies that arise because time is represented as a decimal fraction, and most decimal fractions cannot be represented exactly in binary.
    Last edited by joeu2004; 02-01-2015 at 11:59 PM. Reason: PS (format)

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,646

    Re: Recording and Monitering Times

    Assuming that your actual closing time is around +/- 12 hours from 00:00

    With my formula in #3:

    D21=00:00

    * If late :

    D22=02:00

    ==> D23=02:00

    * If early:

    D22=23:00

    ==> D23= -01:00

    Note that excell gets problem with nagative time, so D23 = "- 01:00" is text displayed as number. In case you wish to use D23 for calculation, i.e adding with D25,try to convert D23 to real number: =D25 + IF(LEFT(D23)="-",-MID(D23,2,5),MID(D23,2,5))
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Recording and Monitering Times

    try this in D23
    =IF(ABS(HOUR(D21)*60+MINUTE(D21)-(HOUR(D22)*60+MINUTE(D22)))>1220,1440-ABS(HOUR(D21)*60+MINUTE(D21)-(HOUR(D22)*60+MINUTE(D22))),ABS(HOUR(D21)*60+MINUTE(D21)-(HOUR(D22)*60+MINUTE(D22))))

+ 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. Recording lap times by entering contestant number
    By groznij in forum Excel General
    Replies: 27
    Last Post: 09-11-2023, 04:47 AM
  2. Session Recording (Login info recording)
    By cvishu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2014, 04:10 PM
  3. [SOLVED] How to revised macro code to repeat the recorded task without recording several times?
    By reimar_rem in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-07-2013, 01:34 AM
  4. If a search term can be found 1 time, 2 times 3 times 4 times 5 times
    By excelcandy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2013, 09:57 PM
  5. [SOLVED] How do I make the Stop Recording bar pop up when recording macros
    By J in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-10-2006, 04:50 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