+ Reply to Thread
Results 1 to 9 of 9

Sorting irregular data Preferably with VBA

  1. #1
    Registered User
    Join Date
    02-26-2007
    Posts
    5

    Sorting irregular data Preferably with VBA

    I have a daily timesheet which is generated using a macro. Some of the staff have 1 shift and some 2, there is also other information on the sheet which relates to each member of staff and their work day (see attached) is there a way of sorting this data by the start of the 1st shifts time?

    Thanks
    Attached Files Attached Files
    Last edited by daymo; 11-06-2011 at 05:07 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Sorting irregular data Preferably with VBA

    What do you mean by start of the 1st Shifts time? Can you cite an example using your attached file?

  3. #3
    Registered User
    Join Date
    02-26-2007
    Posts
    5

    Re: Sorting irregular data Preferably with VBA

    Sure, sorry.

    If you look at F&B Commis 3 they are due to start at 8:00 and finish at 11:30 (the 1st shift) and then start again at 12:00 and finish at 21:30 (2nd shift)

    When sorting the data I would like F&B commis 3 to to be sorted using 8:00 as the start time (ie the start of her 1st shift) and not 12:00 (the start of her second shift)

    Allan R, on the other hand only has one shift that day 14:00 - 00:00 so would like 14:00 to be used to sort him.

    Thanks again

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Sorting irregular data Preferably with VBA

    Ok. Thanks for the explanation. But when i look at the sheet, i see that all the columns are already sorted. So what problem are you facing?

  5. #5
    Registered User
    Join Date
    02-26-2007
    Posts
    5

    Re: Sorting irregular data Preferably with VBA

    I would like to be able to have it sorted so that we have the earliest start times at the top. In otherwords it would be
    Krzystof (06.30)
    Magda (07.00)
    F&B Commis 2 (8.00)
    F&B Commis 3 (8.00)
    Helen (8.00)
    Miguel (8.00)
    Karina(9.30)
    Natalie (11:30)
    F&B Commis1 (12:00)
    Allan (14:00)
    Charlotte (14:00)
    Jekaterina(14:30)
    Sam (17:00)
    Gergely (17:30)

    Or as per the attached

    Thanks

    Simon
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Sorting irregular data Preferably with VBA

    Suggestion!

    Try having data from on person on a single row, with as few possible data in each column

    Like

    Please Login or Register  to view this content.
    Then data below.
    If you create your file in this way it's a lot easier to sort and filter the way you like.

    Steffen Thomsen

  7. #7
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Sorting irregular data Preferably with VBA

    Perhaps this file and macro could be of help to you?

    Alf
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-26-2007
    Posts
    5

    Re: Sorting irregular data Preferably with VBA

    Thanks guys for your help.

    Alf, that's just the ticket - works perfectly. thank you.

  9. #9
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Sorting irregular data Preferably with VBA

    Ok, glad you liked it. The first file is build so you can see what happends. If you think it fits your need and after testing it a bit you could try this file.

    It works in the same way as the first file but it clears all info on sheet2 and copies the sorted info from sheet3 (yes I renamed it back to sheet3) back to sheet1 and then clears all info on sheet3.

    If this takes care of your problem don't forget to mark the tread solved and if you like to give me a pat on the back click on my scale icon and give a rating to my solution.

    Alf
    Attached Files Attached Files

+ 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