+ Reply to Thread
Results 1 to 19 of 19

Split an Excel file into Multiple Sheets Based on a Specific Column

  1. #1
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Split an Excel file into Multiple Sheets Based on a Specific Column

    Hi guys,

    I need to split a excel file in multiple sheets based on column W. Every sheets must be named based on split criteria.
    After that I want to save the resulting sheets in a specific location.
    Thx

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,620

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Some suggestions you may fund useful:
    1. Our answerers are looking to "help" more often than they are looking to "do an entire project for you for free".
    2. Jump into this project yourself, when you get stuck on ONE specific hurdle, post that ONE item as a forum question.
    3. Show us what you've tried in an attached sample workbook and how it's not working for you. When you're doing the work yourself, just writing out a complete example question in a forum often points you to solution before you even finish posting.
    4. If you can't make any headway at all and no help is forthcoming in the free forum(s), we do have a Commercial Services forum where you can pay for assistance directly from our EF gurus."

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    It would be easier to help and test possible solutions if you could attach a copy of your file. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary). See the yellow banner at the top of this page for instructions to attach a file. Do you want each new sheet to be saved as a separate file? What is the full path to the folder where you want to save the files?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Thank you for your reply.
    I can't provide the file, contains some confidential data but I can share my work so far (you will find it below). My approach was to filter the column based on specific criteria, copy filtered cells to another sheet, save that sheet to a specific location, then clear filters and repeat the procedure for another filter criteria.
    I am stuck when one of the filter criteria is missing, I don't know how to skip part of the code when a certain filter criteria is missing.
    How to skip this part of the code when filter criteria NCRT is missing in column W

    Please Login or Register  to view this content.



    My entire code

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    It looks like your code can be shortened. Could you de-sensitize the confidential data and attach a copy of the file? You don't necessarily need to include all the data, just enough rows to make it exactly representative of your actual file. I think the solution can be simple but I can't test it unless I have a file to work with.

  6. #6
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    I have attached the file.
    Thx.
    Attached Files Attached Files

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Try:
    Please Login or Register  to view this content.
    If you need to add another filter criteria, simply add it to the array in the code.

  8. #8
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Should it be new files or new sheets?

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.
    If you need to add another filter criteria, simply add it to the array in the code.

    Thank you very much Mumps1, It works perfectly I owe you

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    You are very welcome.

  11. #11
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Quote Originally Posted by Mumps1 View Post
    You are very welcome.
    Hi Mumps1,

    I really appreciated your help with my request. I have another question, it is possible, adapting the script from you, to split the resulting files based on the currency?. The currency can be EUR, CHF, USD and will always be in column G (the currency may differ from file to file, in one file it may be only CHF and EUR, in another file it may be CHF, EUR and USD).
    The resulting files I would like to be named like this: "INT EUR", "INT CHF" and so on. The files I want to be saved in C:\Users\Home\Desktop\My Folder\Currency. I updated the test file with currency in column G.
    THX
    Attached Files Attached Files

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Do you still want to split and save the data based on "NCRT", "INT", "REV" and then split each resulting file based on currency or just split and save on currency without splitting on "NCRT", "INT", "REV"?

  13. #13
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Quote Originally Posted by Mumps1 View Post
    Do you still want to split and save the data based on "NCRT", "INT", "REV" and then split each resulting file based on currency or just split and save on currency without splitting on "NCRT", "INT", "REV"?
    I want to split and save the data based on "NCRT", "INT", "REV" and then split each resulting file based on currency.

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Try:
    Please Login or Register  to view this content.
    Last edited by Mumps1; 04-27-2020 at 11:38 AM.

  15. #15
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    It is not necessary to quote full messages. You apparently haven't looked at the code in # 8. This is much more efficient and dynamic.

    It is not necessary to always create a tab and delete it.

    Please Login or Register  to view this content.
    Someone with more posts doesn't necessarily write better code

  16. #16
    Registered User
    Join Date
    05-17-2019
    Location
    Ro
    MS-Off Ver
    2016
    Posts
    22

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    Thanks guys, both solutions provided work very well. I am grateful to you.

  17. #17
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    The macro suggested by Vraag en antwoord is excellent. However, it doesn't create the workbooks based on "NCRT", "INT", "REV" without splitting based on currency.

  18. #18
    Valued Forum Contributor
    Join Date
    04-01-2015
    Location
    The Netherlands
    MS-Off Ver
    2003/2007/2010/2016/office 365
    Posts
    880

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    @Mumps1,

    They seemed unnecessary to me. But of course it can be adjusted.

  19. #19
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,028

    Re: Split an Excel file into Multiple Sheets Based on a Specific Column

    I suppose that the OP will have to decide if he/she needs the other files.

+ 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. [SOLVED] Split one excel sheet into multiple sheets based on column value but only selected columns
    By nr6281 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-01-2019, 05:25 AM
  2. Split Excel file into multiple Excel files based on specific column value
    By qiyusi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-04-2018, 10:08 PM
  3. [SOLVED] Macro to split data onto new sheets based on specific column
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-17-2015, 12:53 PM
  4. Split one Excel file into multiple files based on values in column A?
    By MetroBOS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2015, 10:59 AM
  5. Split excel file having multipl sheets into multiple excel file based on column
    By Shaharyarwatto in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2014, 05:02 AM
  6. [SOLVED] How To Split Excel File Into Separate Workbooks Based on Values In a Specific Column
    By UzieJacuzzi in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 07-31-2012, 07:26 AM
  7. Replies: 3
    Last Post: 08-02-2006, 12:35 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