+ Reply to Thread
Results 1 to 7 of 7

Merge Two Columns

  1. #1
    Registered User
    Join Date
    09-21-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    81

    Merge Two Columns

    Hello all,

    Just need a little help writing a macro that will merge two columns together. The columns marked “Retained Notes” and “Frozen Notes” need to be merged into one column simply marked “Notes.” The text (if any) in both columns needs to be merged into one cell in a single column with a space between the text. “Retained Notes” and “Frozen Notes” are the headers in row one. Retained Notes and Frozen Notes are always next to each other, but sometimes not in the same column letter (sometimes in col P sometimes in col O somtimes in col N, etc.). This is why I want to use the column headers in row 1 to identify the columns to merge.

    See attached example.
    Attached Files Attached Files

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Merge Two Columns

    Your sample is very small and does not clearly show what you mean by:

    The text (if any) in both columns needs to be merged into one cell in a single column with a space between the text. “Retained Notes” and “Frozen Notes” are the headers in row one. Retained Notes and Frozen Notes are always next to each other, but sometimes not in the same column letter (sometimes in col P sometimes in col O somtimes in col N, etc.). This is why I want to use the column headers in row 1 to identify the columns to merge.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    09-21-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Merge Two Columns

    Here is another sample that might better illustrate what I mean:
    Attached Files Attached Files

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Merge Two Columns

    Wouldn't then this formula:

    =Before!B2&" "&Before!C2

    copied down do it?

  5. #5
    Registered User
    Join Date
    09-21-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Merge Two Columns

    Yes, however, I am trying to automate this process with a macro. Also, Retained Notes and Frozen Notes are not always in cols B and C. In some worksheets, they are in cols A and B, others they are in cols F and G, etc. This is why I want to use the header in row 1 to identify these cols to merge.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Merge Two Columns

    That is why I asked for a better sample... your sample doesn't illustrate the variations...

    Someone can hopefully come along with a VBA solution for you...

  7. #7
    Registered User
    Join Date
    09-21-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2003
    Posts
    81

    Re: Merge Two Columns

    That would be great - here's an additional sample:
    Attached Files Attached Files

+ 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