+ Reply to Thread
Results 1 to 2 of 2

Duplicate Rows when one field has multiple results

  1. #1
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Duplicate Rows when one field has multiple results

    Hey all,

    I have a couple sheets with a simple ask, that is difficult in practice. See the attached image for a visual example of what I need.

    Basically, I have a file, about 50k rows and about 50 columns.

    Each row contains sales information, including dates, products, dollars, customers, and managers.


    Unfortunately, some of the customers have multiple managers, and these multiple managers are listed in the same row with an ampersand (John Doe & Jane Doe)

    What I need to do is find rows which have this, which is only about 8% of the rows, and make two copies of the rows. The mapping of the names isn't the hard part, I can just use an index/count type formula to put name A in the first row and name B in the second. The main snag is copying these rows. There can be up to 7 names in a single cell, meaning that particular row of data needs to be copied 7 times.

    My first instinct says "dump everything in SQL and force a Cartesian product on the name field", but i'd rather not take that approach if it can be done formulaically
    SplitRows.jpg
    Thoughts?
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Duplicate Rows when one field has multiple results

    Figured out a solution:

    Add an index number to each row (1, 2, 3, and so on)
    Add a second index number for each "block" (1, 1, 1, 1 for entire set)
    Copy all data and paste below, on pasted data, second index number is 2, 2, 2, 2
    Repeat for each possible required duplication - 7 in my case
    Sort data, two levels, so you get 1, 1, 1, 1, 1, 1, 1 in Index, and 1, 2, 3, 4, 5, 6, 7 in the second index
    Text To Columns on the target names, by & to break out all the names into individual columns
    Offset/Index/Match against the second index number to pull the Nth name in

    Remove both index columns, select all, remove duplicates.


+ 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] Highlight Rows of Duplicate results column with unique coloring
    By G-Co in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-24-2017, 07:09 PM
  2. Replies: 8
    Last Post: 06-13-2015, 05:00 PM
  3. Vlook up to multiple (duplicate) results
    By jcicero57 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2013, 02:12 AM
  4. Look up one name, return multiple (non-duplicate) results
    By marklub in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-08-2012, 01:51 AM
  5. [SOLVED] How do I find duplicate rows, add quantity field & retain one reco
    By Pearl in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-23-2006, 04:15 AM
  6. Replies: 0
    Last Post: 09-27-2005, 07:05 PM
  7. Replies: 0
    Last Post: 05-16-2005, 06: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