+ Reply to Thread
Results 1 to 18 of 18

Combining data from two columns

Hybrid View

Guest Combining data from two... 08-02-2006, 02:09 PM
Guest Re: Combining data from two... 08-02-2006, 02:20 PM
Guest Thanks, but I wasn't clear.... 08-02-2006, 02:22 PM
Guest Re: Combining data from two... 08-02-2006, 03:15 PM
Guest RE: Combining data from two... 08-02-2006, 03:15 PM
Guest Thanks CLR, but I'm not... 08-02-2006, 09:33 PM
Guest Bump for help with the code... 08-04-2006, 10:36 AM
Guest Re: Combining data from two... 08-04-2006, 11:10 AM
thepcguild Re: Combining data from two... 12-02-2009, 10:54 PM
shg Re: Combining data from two... 12-02-2009, 11:03 PM
  1. #1
    dziw
    Guest

    Combining data from two columns

    If I have two columns which are lists of names, how do I make a new column which merges the names from each column into one list, and will refresh when new data is added to the two originals.

  2. #2
    PCLIVE
    Guest

    Re: Combining data from two columns

    Try:

    =A1 & A2
    or
    =A1 & " " & A2 (if you want a space between the two text
    items...)

    or
    =CONCATENATE(A1 & B1)

    =CONCATENATE(A1," ",B1) (if you want a space between the two text
    items...)


    "dziw" <dziw.2bxcus_1154542206.791@excelforum-nospam.com> wrote in message
    news:dziw.2bxcus_1154542206.791@excelforum-nospam.com...
    >
    > If I have two columns which are lists of names, how do I make a new
    > column which merges the names from each column into one list, and will
    > refresh when new data is added to the two originals.
    >
    >
    > --
    > dziw
    > ------------------------------------------------------------------------
    > dziw's Profile:
    > http://www.excelforum.com/member.php...o&userid=10422
    > View this thread: http://www.excelforum.com/showthread...hreadid=567563
    >




  3. #3
    dziw
    Guest
    Thanks, but I wasn't clear. Each column is a separate category of names, so I'm not combining each cell (i.e. first & last), but am making a new longer column combining all the names from each column.

  4. #4
    PCLIVE
    Guest

    Re: Combining data from two columns

    Here's some code you might be able to use.



    Range("A1:" & Range("A65536").End(xlUp).Address).Select
    Selection.Copy

    Range("C1").Select
    ActiveSheet.Paste

    Range("B1:" & Range("B65536").End(xlUp).Address).Select
    Selection.Copy

    Range("C65536").End(xlUp).Select
    ActiveSheet.Paste

    'If you want to remove duplicate names or entries, use this code
    ' This function must sort first.
    Range("C1:" & (Range("C65536").End(xlUp).Address)).Select
    Selection.Sort Key1:=Range("C1"), Order1:=xlAscending,
    Header:=xlNo, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    ColNum = Selection(1).Column
    For RowNdx = Selection(Selection.Cells.Count).Row To _
    Selection(1).Row + 1 Step -1
    If Cells(RowNdx, ColNum).Value = Cells(RowNdx - 1, ColNum).Value
    Then
    Cells(RowNdx, ColNum).Value = ""
    End If
    Next RowNdx

    Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlNo, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

    'End Remove Duplicates



    If you want it to update when the worksheet is changed, right-click on that
    worksheet and select View code.
    Click General dropdown and select Worksheet. Click other dropdown and
    select Change. Then enter the code above.

    HTH,
    Paul





    "dziw" <dziw.2bxdjs_1154543106.9206@excelforum-nospam.com> wrote in message
    news:dziw.2bxdjs_1154543106.9206@excelforum-nospam.com...
    >
    > Thanks, but I wasn't clear. Each column is a separate category of names,
    > so I'm not combining each cell (i.e. first & last), but am making a new
    > longer column combining all the names from each column.
    >
    >
    > --
    > dziw
    > ------------------------------------------------------------------------
    > dziw's Profile:
    > http://www.excelforum.com/member.php...o&userid=10422
    > View this thread: http://www.excelforum.com/showthread...hreadid=567563
    >




  5. #5
    CLR
    Guest

    RE: Combining data from two columns

    Assuming names start in A1 and B1, in C1 put this formula and copy
    down.........

    =A1&" "&B1

    or

    =B1&" "&A1

    hth
    Vaya con Dios
    Chuck, CABGx3



    "dziw" wrote:

    >
    > If I have two columns which are lists of names, how do I make a new
    > column which merges the names from each column into one list, and will
    > refresh when new data is added to the two originals.
    >
    >
    > --
    > dziw
    > ------------------------------------------------------------------------
    > dziw's Profile: http://www.excelforum.com/member.php...o&userid=10422
    > View this thread: http://www.excelforum.com/showthread...hreadid=567563
    >
    >


  6. #6
    dziw
    Guest
    Thanks CLR, but I'm not trying to combine each cell together. I'm trying to make a new column (C) which includes each name from two other columns (A & B) and refeshes when A or B is updated with new names.

    PCLIVE-- How do I use that code?

  7. #7
    dziw
    Guest
    Bump for help with the code or other suggestions

  8. #8
    CLR
    Guest

    Re: Combining data from two columns

    Here's a little mod of PCLIVE's code......

    Sub CombineColumns()
    'This macro will clear the contents of column C, then
    'copy the values from column A to column C, and then
    'append the values in column B to the bottom of that list in column C
    Range("c:c").ClearContents
    Range("A1:" & Range("A65536").End(xlUp).Address).Select
    Selection.Copy
    Range("C1").Select
    ActiveSheet.Paste
    Range("B1:" & Range("B65536").End(xlUp).Address).Select
    Selection.Copy
    Range("C65536").End(xlUp).Select
    Selection.Offset(1, 0).Select
    ActiveSheet.Paste
    End Sub

    Vaya con Dios,
    Chuck, CABGx3



    "dziw" wrote:

    >
    > Bump for help with the code or other suggestions
    >
    >
    > --
    > dziw
    > ------------------------------------------------------------------------
    > dziw's Profile: http://www.excelforum.com/member.php...o&userid=10422
    > View this thread: http://www.excelforum.com/showthread...hreadid=567563
    >
    >


  9. #9
    dziw
    Guest
    Thanks alot. It works.

    I'm not really familiar with coding, so how would I change the references if I'm referring to column A in another worksheet.

  10. #10
    Registered User
    Join Date
    12-02-2009
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Combining data from two columns

    Or you can simply use the DigDB plugin - its much easier and faster.

    Details: Append data to column in Excel using DigDB

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Combining data from two columns

    Please don't post in old threads.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ 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