+ Reply to Thread
Results 1 to 14 of 14

Sorting export Data

  1. #1
    Registered User
    Join Date
    05-29-2015
    Location
    Stoke-On-Trent, England
    MS-Off Ver
    2010
    Posts
    40

    Sorting export Data

    Hi All

    I have an export from a system that I need to sort so that it is easier to work with.

    I would like to do this through VBA. I have attached a copy of a sample file. Sheet 1 is how the report will export. Sheet 2 is the ideal output of the report.

    Also I have a couple of considerations to take in to account and this is where I am getting stuck:

    1 - The team size of the team will change depending on which team I have exported the data for. This would mean that the ranges would need to be dynamic. Employee will always appear to the left of a date and above the peoples names.

    2 - The Labour Number is not an individual reference instead this links people back to a Department & Area

    3 - any field which contains data like "M 8:00" would need to be changed to something such as "MAT/PAT"

    That should pretty much cover it all but if you do have any questions please feel free to drop me a line I will be more than happy to help

    Thank you in advance for any support that you may be able to give

    D
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Sorting export Data

    There is no Sheet 2...?
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,934

    Re: Sorting export Data

    Your example workbook only has one sheet, so there is no 'ideal' sorting to view
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Sorting export Data

    this collates the data, then you can remove the unwanted EMPLOYEE recs, zero work,etc
    rename M8:00
    and parse the WorkTime into StartTime and EndTime

    run: aParseTime

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-29-2015
    Location
    Stoke-On-Trent, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sorting export Data

    Thank you for the quick response I have ran updated the macro in the workbook and I am just left with a number of worksheets with no shift information on?

    Would it be possible for you to offer any further guidance at all?
    Last edited by AliGW; 04-03-2018 at 07:55 AM.

  6. #6
    Registered User
    Join Date
    05-29-2015
    Location
    Stoke-On-Trent, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sorting export Data

    Quote Originally Posted by Bernie Deitrick View Post
    Your example workbook only has one sheet, so there is no 'ideal' sorting to view
    Hi thanks for the quick response I uploaded the attachment before I had saved the changes to the work book .

    Here is I have now added the correct work book to this post.

    Hope that this helps more than the last one did
    Attached Files Attached Files

  7. #7
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Sorting export Data

    You can do it with Power Query:

    fnTransform:
    Please Login or Register  to view this content.
    Output:
    Please Login or Register  to view this content.




    Or, with VBA:
    Please Login or Register  to view this content.
    Sample workbooks for both approaches are attached
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-29-2015
    Location
    Stoke-On-Trent, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sorting export Data

    Hi

    Thank you for the reply again.

    I have ran the VBA version which is my prefered method which worked great for a small team. When I try to upscale this to a much larger team the dates are not placed in the top row? on the first loop they get placed in row 28? They are also not consistently separated?

    Do you know how I can upscale the macro to work for teams that consist of over 200 people?

    Any further help that you can give would be really appreciated.

    Thanks again

    D
    Last edited by AliGW; 04-03-2018 at 07:55 AM.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,288

    Re: Sorting export Data

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Sorting export Data

    Please Login or Register  to view this content.
    Last edited by jindon; 04-03-2018 at 08:52 AM.

  11. #11
    Registered User
    Join Date
    05-29-2015
    Location
    Stoke-On-Trent, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sorting export Data

    Hi jindon

    Thanks for that, that is amazing.

    Is there a way of setting the output to be on the same sheet every time at all?

    Thank you again

    D

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Sorting export Data

    Add sheet named "Sheet2" if not in the workbook.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    05-29-2015
    Location
    Stoke-On-Trent, England
    MS-Off Ver
    2010
    Posts
    40

    Re: Sorting export Data

    Hi Again.

    That is great and is working Fantastically. I have just noticed that some people have 2 lines of data. This is due to the way the information is exported by the systems (which can not be changed). is there a way of amending the VBA so that it does one of the 2 options below:

    1. Only pulls out the pay codes for example "Hol 8:00, .Ho 4:00, Dec 8:00" and so on

    2. Populate 2 worksheets with the lines of data. in worksheet one you would have the full day scheduled events in the second sheet you would have the partial/additional scheduled events.

    I know that the above is a little confusing so if you have any questions or require a sample of data please let me know

    Thank you again for all of the support with this it really is appreciated!

    Thanks

    D

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,514

    Re: Sorting export Data

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

+ 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. Replies: 0
    Last Post: 11-10-2016, 10:18 AM
  2. Replies: 1
    Last Post: 12-16-2015, 01:04 PM
  3. Replies: 0
    Last Post: 12-02-2014, 05:02 PM
  4. Replies: 0
    Last Post: 02-24-2014, 11:27 AM
  5. Sorting 2 data ranges by comparing one column in each and sorting to match
    By MDKsmiffy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-17-2013, 03:30 PM
  6. I would need a macro to export data from base example workbook to export worbook
    By slato8 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2012, 11:21 AM
  7. Replies: 0
    Last Post: 10-14-2010, 08:22 AM

Tags for this Thread

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