+ Reply to Thread
Results 1 to 6 of 6

How to merge two data sets to create a single large data set.

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    How to merge two data sets to create a single large data set.

    Hi. The attached example represents what I am looking for.

    Array 1: List of names
    Array 2: List of activities

    Result I want: I want every name to be associated to every single activity. So 5 names and 3 activities would result in an array that is 2*15.

    Is there a formula based approach to doing this?

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to merge two data sets to create a single large data set.

    1) I moved the lists into columns A and B to eliminate blank cells
    2) I created two dynamic named ranges, NameList and StepList. Check the Ctrl-F3 Name Wizard to see the formulas used. You can add to the column A and B lists and these named ranges will expand themselves automatically.

    3) I've added formulas in D2 and E2, then copied down a ways. These formulas will create a new list for you based on the number of items in the two lists.

    D2: =IFERROR(INDEX(NameList,INT((ROW()+1)/(COUNTA(StepList))-1)+1),"")
    E2: =IF(D2="", "", INDEX(StepList, IF(MOD(ROW()-1,COUNTA(StepList))=0, COUNTA(StepList), MOD(ROW()-1,COUNTA(StepList)))))
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: How to merge two data sets to create a single large data set.

    Thank you very much.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to merge two data sets to create a single large data set.

    You had a question? Post the question here along with a sample doc that demonstrates the problem.

  5. #5
    Registered User
    Join Date
    08-17-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: How to merge two data sets to create a single large data set.

    Attached is the problem I am having with the original formula. When I add to the Data column, the formula produces a result that I can't fix.
    Attached Files Attached Files

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: How to merge two data sets to create a single large data set.

    I've put slightly different formulae in G and H - these seem to work.

    Hope ths helps.

    Pete
    Attached Files Attached Files

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to merge two data sets to create a single large data set.

    Thanks Pete, very nice!

+ 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