+ Reply to Thread
Results 1 to 10 of 10

sort & export selective records to new csv

  1. #1
    Registered User
    Join Date
    10-24-2023
    Location
    Jacksonville, Florida
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2309 Build 16.0.16827.20166) 32-bit
    Posts
    4

    sort & export selective records to new csv

    I've attached an example of the original master file as well as the desired results file. The master file has column A with the "Plan" name. The attached file has 608 columns or "records", and when sorting the row alphabetically, you will see where there are sometimes only one record for that plan or multiple records with the same plan name. I'm needing to sort the records separately that are the same plan and save only those records as a new csv file. The resulting saved files I will then merge as variable data to a pdf for printing personalized statements. That part I have figured out, just need assistance with getting the records separated. Any suggestions?

    Thanks in advance for your help.
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: sort & export selective records to new csv

    I believe this is what you are seeking :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: sort & export selective records to new csv

    Attached is a Power Query Solution.
    Select the Plan ID you wish to see.
    Click on the Command Button
    Look at the Results on the Result Page.
    Copy and paste results to new workbook and save as .csv file.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    10-24-2023
    Location
    Jacksonville, Florida
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2309 Build 16.0.16827.20166) 32-bit
    Posts
    4

    Re: sort & export selective records to new csv

    Thank you very much for looking into this. The Macros work with the exception of this error that occurs after creating individual worksheets within the file. I did debug and change the path however still receive this error. Screenshots attached. Any suggestions?
    Attached Images Attached Images

  5. #5
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: sort & export selective records to new csv

    Your pictures are too small for me to read with any detail.

  6. #6
    Registered User
    Join Date
    10-24-2023
    Location
    Jacksonville, Florida
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2309 Build 16.0.16827.20166) 32-bit
    Posts
    4

    Re: sort & export selective records to new csv

    Hopefully these attached are legible
    Attached Images Attached Images

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: sort & export selective records to new csv

    Did you test the PQ solution I provided?

  8. #8
    Registered User
    Join Date
    10-24-2023
    Location
    Jacksonville, Florida
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2309 Build 16.0.16827.20166) 32-bit
    Posts
    4

    Re: sort & export selective records to new csv

    Hello Alan. First, thank you for your work on this. Yes I did test and receive the error in the above screenshots. It seems that once the first Macro is completed, the second Marco to save each worksheet as an individual file fails. I did try to debug and change the destination path, but have not gotten that to work. Any suggestions?

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: sort & export selective records to new csv

    I believe that the errors you are receiving are not from the file I provided. I provided a PQ solution in post #3. The command button (Macro) has one line of code to Refresh the output.

    It reads
    Please Login or Register  to view this content.

  10. #10
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: sort & export selective records to new csv

    Did you first create a folder on your desktop named 'Test' ?

+ 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. Restoring original records before the export
    By mifzal.mufthi in forum Excel General
    Replies: 10
    Last Post: 03-17-2014, 02:00 PM
  2. Need Excel Macro to get selective records, from Excel Based Database.
    By KetanVispute in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2013, 11:11 AM
  3. Replies: 4
    Last Post: 07-18-2013, 06:29 AM
  4. Export More than 65,000 Records
    By ncurran217 in forum Access Tables & Databases
    Replies: 5
    Last Post: 02-13-2012, 05:45 PM
  5. Duplicate check on export of records
    By mbrady1973 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-28-2008, 07:53 PM
  6. [SOLVED] search and export multiple records
    By Richard R in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-17-2006, 05:50 PM
  7. How to export Records from Excel to Outlook Contacts?
    By Michael in forum Excel General
    Replies: 2
    Last Post: 06-29-2005, 07:42 AM
  8. [SOLVED] How do I export an excel file as fixed length records
    By iainjh in forum Excel General
    Replies: 2
    Last Post: 03-03-2005, 02:06 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