+ Reply to Thread
Results 1 to 4 of 4

Sort records into different arrays based on certain criteria

  1. #1
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Sort records into different arrays based on certain criteria

    I have code that will save a mail merge as individual documents (below). I want to modify my code so that it will find all the templates in a folder and perform multiple mail merges, one for each template. I'm trying to go through my record list, sort each record into the appropriate "bin" based on the "form" field, and then run each mail merge based on the appropriate bin.

    Example:
    Have Template1.docm (for Form A) & Template2.docm (for Form B)
    Records:
    1 Form A Info1
    2 Form A Info2
    3 Form B Info3
    4 Form A Info4
    5 Form B Info5

    Output:
    3 Form A letters using Info1, Info2, and Info4 with Template1
    2 Form B letters using Info3 and Info5 with Template2

    The part I'm stuck at now is how to sort the record #s into arrays so that I have
    records(1,1) = 1
    records(1,2) = 2
    records(1,3) = 5
    records(2,1) = 3
    records(2,2) = 4

    How many of each form I have could change. Ideally, I also want my program not to have to know how many different forms there are when it starts.

    Thanks for your help

    My working Mail Merge code:
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Sort records into different arrays based on certain criteria

    To simplify the problem, how can I take this input:
    A B
    1 Form A
    2 Form A
    3 Form B
    4 Form A
    5 Form B

    And fill an array records(x,y) such that:
    records(1,1) = 1
    records(1,2) = 2
    records(1,3) = 5
    records(2,1) = 3
    records(2,2) = 4

  3. #3
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Sort records into different arrays based on certain criteria

    Alright, one more bump to try to get an answer. What the best way to sort records into a jagged array of categories? See the attached workbook.
    Attached Files Attached Files
    1. Include a sample workbook with an example of the result you want
    2. Use [CODE] and [FORMULA] wrappers for your VBA code or excel formulas
    3. If your question has been answered, mark the thread as SOLVED and click on the "Add Rep" star to thank whoever helped you.

  4. #4
    Valued Forum Contributor
    Join Date
    08-06-2013
    Location
    Detroit, Michigan
    MS-Off Ver
    Excel 2013
    Posts
    671

    Re: Sort records into different arrays based on certain criteria

    Hey guys, I haven't received any replies. Is my example not clear? Is the question too difficult? Are people not seeing this? Without any responses, I can't tell why I'm not getting an answer. If you see this post and aren't going to answer it, reply to let me know why.

+ 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. Conditions/criteria based on arrays with different formulas?
    By nikojago in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-16-2013, 12:11 PM
  2. Unique records based on criteria
    By Ganesh7299 in forum Excel General
    Replies: 4
    Last Post: 09-25-2013, 07:55 AM
  3. Dynamic Arrays - Selecting some rows based on criteria
    By AHFoddeR in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-23-2013, 03:55 AM
  4. eliminate records based on 3 criteria!
    By cyoung315 in forum Excel General
    Replies: 2
    Last Post: 04-26-2007, 10:28 AM
  5. [SOLVED] Product of 2 arrays based on criteria
    By Ben010 in forum Excel General
    Replies: 4
    Last Post: 03-20-2006, 03:55 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