+ Reply to Thread
Results 1 to 8 of 8

24hr Timing issue

  1. #1
    Registered User
    Join Date
    07-31-2007
    Location
    Newcastle Upon Tyne, UK
    MS-Off Ver
    2003
    Posts
    20

    24hr Timing issue

    Hi, i really hope someone can help me with this problem. I'm ok with excel formulas, but damn this problem has been doing my head in for a few days now.

    anyway, i have a huge spreadsheet with individuals arrival date and time (A2) and leaving date and time (B2). These date and time entries are in the format: "dd/mm/yyyy hh:mm".

    Ultimately i need to show how many are in attendance at any given day and time. I have decided the best way to do this is to have hour slots (columns) and then have a formula to simply insert a "1" in each and every hour slot that the case was present until leaving. this works fine, until the person leaves the next day - i cannot get the formula to handle the 24hr time!.

    To give you and idea of the ideal ultimate outcome - what i am eventually wanting to do is plot on a chart the busiest hours. I have thousands of row entries of arrival and leaving times going back a couple of years.

    i have attached a simple cut down version of the problem. Any help is appreciated.
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: 24hr Timing issue

    here's one relatively long winded approach:

    Please Login or Register  to view this content.
    Apply across matrix

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: 24hr Timing issue

    Try this in U2

    =IF(AND(MOD($A2,1) <=U$1+TIME(1,0,0),U$1<=MOD($B2,1)+(INT($B2)>INT($A2))),1,"")
    Last edited by Bob Phillips; 07-10-2009 at 07:42 AM. Reason: Corrected cell refs as pointed out by DonkeyOte

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: 24hr Timing issue

    Hi Bob, I think the cell refs in your formula are slightly awry ... also does not account for DateTime stamp values in A/B (ie A/B always > row 1) ... as I see it also ignores issues of crossing midnight but I could be wrong...

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: 24hr Timing issue

    Quote Originally Posted by DonkeyOte View Post
    Hi Bob, I think the cell refs in your formula are slightly awry ... also does not account for DateTime stamp values in A/B (ie A/B always > row 1) ... as I see it also ignores issues of crossing midnight but I could be wrong...
    I originally put it in U15, hence the invalid cell references, so I could check my results against the example, and it worked fine, but I made a right mess of transcribing it.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: 24hr Timing issue

    Thanks for the update... that said I still don't think the revised version in it's current format captures hours worked in the am when crossing midnight (the AND in present format would never be True in the early hours).

    Edit: as I say I think post # 2 works but must be a more succinct approach available...
    Last edited by DonkeyOte; 07-10-2009 at 07:55 AM.

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: 24hr Timing issue

    You could use this formula in C2 copied across and down

    =IF((MOD($A2,1)-"1:00"<C$1)+(MOD($B2,1)>C$1)+(MOD($B2,1)<MOD($A2,1))=2,1,"")
    Last edited by daddylonglegs; 07-10-2009 at 08:05 AM.

  8. #8
    Registered User
    Join Date
    07-31-2007
    Location
    Newcastle Upon Tyne, UK
    MS-Off Ver
    2003
    Posts
    20

    Re: 24hr Timing issue

    Hi guys, all this is absolutely brilliant. i've been trying to solve this for 2 days and you guys came back to me in minutes! Ive tried all the suggestions and they all work to some extend, but bobs formula does show issues with handline am times. nevertheless; all the help is great. think i'll use this forum more often in future! thanks!

+ 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