+ Reply to Thread
Results 1 to 9 of 9

Sorting with Dates!

  1. #1
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Sorting with Dates!

    I have a question a fairly simple question which I could do myself only I’ve not done this before with dates. Please see the attached example.

    What I’d like to do is (and this is part of an export from a less than perfect staffing system) basically have excel tell me who’s pulled a double shift two 24 hour shifts back to back. I just need it to tell me who and how many. I’d like excel to reference the name in column E-K as the name of the employee then check the dates in column E-G and finally check if there are two 24 hour shifts in use by checking the dates vs column P-Q. An example for the employee “John” rows 12 and 13 shows he worked 01/06/09 and 01/07/09 and did a 24 hour shift each time.

    I know I can have excel count all kinds of thing but I’m lost to have it understand dates and check it vs two 24 hour shifts.

    Thanks!
    Attached Files Attached Files
    Last edited by VBA Noob; 03-18-2009 at 04:01 PM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Simple Question Sorting with Dates!

    Isn't this simply a case of:

    Given a date in column E if it's 1 more than it's preceding date and the equivalent hours in column Q are both 24 then employee has worked two 24 hrs shifts on consecutive days.

    Ok, I'm not sure why you have a space between all the rows except row 12 and 13, maybe youve deliberately entered data to provide an example.

    If there is always a space between dates then

    From R6 downwards enter

    =IF(AND(E6=E4+1,Q6=24,Q4=24),1,0)

    Column R will show a 1 where they have worked double shift on consecutive days else it will show 0.

    If there may or may not be a space between rows you need to delete the rows that are empty and amend E4 and Q4 in the formula above to E5 and Q5 respectively.

    What happens when an employee does a 24 shift on Friday and the same on Monday?
    This solution only picks up consecutive days not consecutive working days.
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Simple Question Sorting with Dates!

    Thank you for your response!

    The spaces between the rows contained personal information about the employee position I deleted it, sorry I should have put something in there! The employee’s work 24 hour shifts the days they work are irrelevant as they operate 24-7-365.

  4. #4
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Simple Question Sorting with Dates!

    Quote Originally Posted by Special-K View Post
    Isn't this simply a case of:

    Given a date in column E if it's 1 more than it's preceding date and the equivalent hours in column Q are both 24 then employee has worked two 24 hrs shifts on consecutive days.

    Ok, I'm not sure why you have a space between all the rows except row 12 and 13, maybe youve deliberately entered data to provide an example.

    If there is always a space between dates then

    From R6 downwards enter

    =IF(AND(E6=E4+1,Q6=24,Q4=24),1,0)

    Column R will show a 1 where they have worked double shift on consecutive days else it will show 0.

    If there may or may not be a space between rows you need to delete the rows that are empty and amend E4 and Q4 in the formula above to E5 and Q5 respectively.

    What happens when an employee does a 24 shift on Friday and the same on Monday?
    This solution only picks up consecutive days not consecutive working days.
    Sorry I misunderstood. The reason there’s a row between the rows is because the example is an output from a staffing program I’ve no control over that. The program won’t tell me what I need to know so I’m thinking I could dump a report from it and use excel to sort it.

    I don’t appear to be able to get:

    =IF(AND(E6=E4+1,Q6=24,Q4=24),1,0)

    To do anything for me, everything returns as 0 even though it should be showing a 1 from row 12 and 13?

  5. #5
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Smile Re: Sorting with Dates!

    Anyone have any idea's?

  6. #6
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Smile Re: Sorting with Dates!

    Ok I'm lost here.. I can't get that formula to show a 1 everything is zero and it complains about the cells not being the same size? Is there any way I can do this without having to change the example too much. The example is an export from a not so great staffing system.

    I'd like to get a tally on how many times each person has pulled a double shift.. two 24 hour shifts side by side. As the everyone can work 24-7-365 weekends and holidays don't matter.

  7. #7
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Sorting with Dates!

    I'm still not getting it? I can't sort it by date either or else this might be easy! It's talking about merged cells being the same size! Any suggestions on making this thing would would be most welcome.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Sorting with Dates!

    Any suggestions
    Don't merge cells.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Registered User
    Join Date
    02-05-2009
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Sorting with Dates!

    Quote Originally Posted by shg View Post
    Don't merge cells.
    I didn't.. the great "staffing system" spits out it's reports in excel like that. If unmerged the data gets spread out.

+ 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