+ Reply to Thread
Results 1 to 7 of 7

Conditional copy/merge of rows into single row

  1. #1
    Registered User
    Join Date
    03-14-2006
    Posts
    12

    Conditional copy/merge of rows into single row

    I'm not able to find this situation covered in other posts, but am wondering how to merge/copy data from all rows which have the same value in the first column into a single row.

    The attached file shows this best.

    Basically, if cells A1, A2 and A3 all say, "Smith", I want to be able to put any data found in rows 1, 2 or 3 all into row 1 while retaining the value shown in Column A.

    Then if cells A4 and A5 say, "Johnson", I want to be able to put any data found in rows 4 or 5 into row 4, again, while retaining the value shown in Column A.

    Some names may appear in five rows. Some may appear in three. There is no set pattern as to how often each name will occupy a row.

    Any ideas? Thanks!
    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: Conditional copy/merge of rows into single row

    Try this:
    Please Login or Register  to view this content.

    Tweaked from one of my macros here:
    Columns to rows - Part 3
    _________________
    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
    03-14-2006
    Posts
    12

    Re: Conditional copy/merge of rows into single row

    Perfect! Thank you!

  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: Conditional copy/merge of rows into single row

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  5. #5
    Registered User
    Join Date
    03-27-2012
    Location
    Bloomington, MN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Conditional copy/merge of rows into single row

    This is fabulous. I'm wondering if there is a way to tweak it to work for me. What I need to do is merge information where any rows which have matching entries in cells columns A thru F will have all other cells in their rows G through infinity merge, but not add/sum any numerical information. In practice, doing this should only replace blank cells with text and/or numbers, but on the off chance that there are two numerical values that need to merge, I would want them both to show. Similarly on the off chance that there were two sets of text, I would want them both to appear in a single cell.

    What I'm trying to do is take an updated list of students who have applied to a program which will include students from older lists, but also new students who have applied since the last list was run & merge it with the old list which also contains columns of text and numerical values which have been manually entered. I want to get rid of new blank rows where the entries in columns A-F match 100%, retain the manually entered notes, and not delete or copy information into rows of students who are appearing on the list for the first time (and thus have not had any notes manually entered). So the "copy from line below" formula will not work because in some cases that might copy notes from one student into another since some students will only have a single row whereas others will be repeat. I hope that makes sense. I need to do this weekly, so not having to manually/eyeball deleting duplicate rows & copying/pasting unique note cells would be a godsend.

    Any advice would be greatly appreciated!

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Conditional copy/merge of rows into single row

    Welcome to the Forum, Atusing, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Registered User
    Join Date
    03-27-2012
    Location
    Bloomington, MN
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Conditional copy/merge of rows into single row

    Quote Originally Posted by arlu1201 View Post
    Welcome to the Forum, Atusing, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    So sorry & thanks for letting me know. I will create a new thread now.

+ 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