+ Reply to Thread
Results 1 to 29 of 29

Combine Two Columns of Names and Create Third Alphabetized Column

  1. #1
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Combine Two Columns of Names and Create Third Alphabetized Column

    I created a sample spreadsheet but I am not able to upload it for some reason. I have uploaded samples files before (using Manage Attachments) but today for some reason, it won't upload the Excel file from my computer.

    The spreadsheet has names in columns A and C. I want to be able to create a third column (in the sample it is E) that combines A and C and alphabetizes the list into E.

    In the real world, A and C are variable lengths and will change month to month.

    Thank you in advance! (I will keep trying to upload the sample file)

  2. #2
    Valued Forum Contributor
    Join Date
    05-07-2014
    Location
    India
    MS-Off Ver
    MS Office 365
    Posts
    313

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Hi,

    If you are able to attach the file here please insert the image one for query and 2nd for require result.

    Also, you can try the concatenate function to combine col A & C.

    I assume you have "XYZ" in cell A2, "ABC" in cell C2 then your E2 would be
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You can remove ( ," ", ) If you do not wish to keep space in between.

    Thanks
    Nisha
    Last edited by Nisha Dhawan; 04-29-2015 at 12:50 AM.

  3. #3
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Thank you for the reply. I am still trying to upload the sample file without success.

    To make my situation clearer, I want to take two columns of names and make one column of names and then alphabetize the list. I do not want to do something like add a last name from one column and a first name from another column and then put them together. I want to intermingle the two columns and have it alphabetized. I know my sample file would make this clearer but until I can upload it... grrrr.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    See if you can modify this to do what you want, I used a helper column to combine the 2 sets of text - you can hide this if needed...
    A
    B
    C
    D
    14
    Orange aa Orange aa [BGCOLOR=#BDD7EE]Apple bb[/BGCOLOR]
    15
    Apple bb Apple bb [BGCOLOR=#BDD7EE]Apple cc[/BGCOLOR]
    16
    Apple cc Apple cc [BGCOLOR=#BDD7EE]Grapes bb[/BGCOLOR]
    17
    Mango aa Mango aa [BGCOLOR=#BDD7EE]Grapes cc[/BGCOLOR]
    18
    Grapes bb Grapes bb [BGCOLOR=#BDD7EE]Mango aa[/BGCOLOR]
    19
    Grapes cc Grapes cc [BGCOLOR=#BDD7EE]Orange aa[/BGCOLOR]


    C14=A14&" "&B14
    D14=INDEX($C$14:$C$19,MATCH(SMALL(IF($C$14:$C$19="","",COUNTIF($C$14:$C$19,"<"&$C$14:$C$19)+1),ROW()-ROW($D$14)+1),IF($C$14:$C$19="","",COUNTIF($C$14:$C$19,"<"&$C$14:$C$19)+1),0))
    D14 is an ARRAY formula...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    (that big formula is courtesy of Bebo's help file)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    sth like this?

    Abab Kibab
    Cabab Ubab
    Ebab Zubab

    and result:
    Abab
    Cabab
    Ebab
    Kibab
    Ubab
    Zubab

    edit: Ford was faster

  6. #6
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    I will study your post - thank you for taking the time to do this. In the meantime - here is my sample file.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Sandy - that is exactly it.

  8. #8
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Quote Originally Posted by sandy666 View Post
    edit: Ford was faster
    Yes he faster was but you have the right idea. He appended column A with column B and then alphabetized them. I will have to remember this because I may need to use this in the near future.

  9. #9
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    But you really want formula ?
    I think some hits on keyboard is much faster
    ctrl+c, ctr+v, data, sort AZ

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    CW, I could probably do it without the helper, but that formula would probably end up very complex

    @ Sandy, yes that would be pretty slick, but would need to be repeated if the data gets updated (may still be faster than a ton of my array formulas though)

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    that's why I prefer after copied data second under first:
    select first cell, Shift+Ctrl+arrow down, sort AZ

    edit:
    but if it will be updated frequently, I think sorting formula is correct
    or very simply macro
    Last edited by sandy666; 04-29-2015 at 01:38 AM.

  12. #12
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Thank you Ford. I am not opposed to using a helper - in the real file - this is a helper tab anyways. I am gathering data from different sources and now I want to merge the data into one column so I can use the names to gather additional data (index-match). In my final report, I want all the names alphabetized.

    In the real file, I could be working with upwards of a couple hundred names which (every month) has the ability to change, have a few names removed, added or even have spelling changed. In addition, this list is only a small portion of the final report which will be produced from various helper tabs.
    Last edited by CWatsonJr; 04-29-2015 at 01:39 AM. Reason: clarify post

  13. #13
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    problem with upload so external link should be working

    sorted column with helper column

    maybe it will help you ...

  14. #14
    Valued Forum Contributor
    Join Date
    03-20-2011
    Location
    UK
    MS-Off Ver
    Excel 2007/10/16
    Posts
    840

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Hi

    F2
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    This is array formula! Press same time Ctrl+Shift+Enter, Array like this {} DO NOT PRESS ENTER!


    Regard
    Attached Files Attached Files
    Last edited by micope21; 04-30-2015 at 03:02 AM.
    To help you by my post? it would be nice to click on to say "Thank you".
    If you are happy with a solution to your problem?
    Click Thread Tools above your first post,
    select "Mark your thread as Solved".

  15. #15
    Valued Forum Contributor
    Join Date
    05-20-2013
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2013
    Posts
    941

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Last edited by jhren; 04-29-2015 at 08:45 AM.

  16. #16
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Quote Originally Posted by jhren View Post
    With helpers (no array formulas)

    Alternate link: https://drive.google.com/file/d/0B24...ew?usp=sharing
    Thank you - this worked perfectly!! I change it a little. I took out the hard coding of the row references and took the entire columns of data (i.e. a:a, g:g, i:i, etc.) and I moved the helper columns to the left of the alphabetized list. This makes it cleaner for the data I collect from the alphabetized list.

    Thank you everyone for your wonderful suggestions!!! As always - this forum is the best!

  17. #17
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Quote Originally Posted by sandy666 View Post
    problem with upload so external link should be working

    sorted column with helper column

    maybe it will help you ...
    I am so glad it wasn't just me. I was going crazy trying to figure out why I couldn't upload my file. I had no idea there was a minimum file size for the upload (taking two files and uploading them together solved that problem).

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    This would be a lot easier if the names were in a single column.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  19. #19
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    You're right but since the two columns of names come from different data sources, I can't predict month to month how many names will will come from each source. So putting them in two columns is the logical choice.


    Sent from my iPad using Tapatalk

  20. #20
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Ok, how about this...

    We can use a formula to combine the 2 lists into a single column then use a formula to create the final sorted list. For example:

    Data Range
    A
    B
    C
    D
    1
    List1
    List2
    Combined
    Sorted
    2
    1
    8
    1
    1
    3
    5
    2
    5
    2
    4
    3
    7
    3
    3
    5
    4
    8
    4
    6
    6
    2
    5
    7
    7
    6
    8
    4
    7
    9
    6
    8
    10
    ------
    ------
    ------
    ------

  21. #21
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Check out jhren's post. It does this exactly (with three helper columns). It works great. I thought I set the status of this as solved. I am on my iPad right now so I will log in and make sure. Thank you.


    Sent from my iPad using Tapatalk

  22. #22
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Here's my offering...

    Create the combined list...

    Enter this formula in G3 and copy down until you get blanks:

    =IFERROR(IF(ROWS(G$3:G3)>ROWS(A$3:A$30),INDEX(C$3:C$15,ROWS(G$3:G3)-ROWS(A$3:A$30)),INDEX(A$3:A$30,ROWS(G$3:G3))),"")

    Create the sorted list...

    Enter this array formula** in E3 and copy down until you get blanks:

    =IFERROR(INDEX(G$3:G$50,MATCH(SMALL(IF(G$3:G$50<>"",COUNTIF(G$3:G$50,"<"&G$3:G$50)),ROWS(E$3:E3)),IF(G$3:G$50<>"",COUNTIF(G$3:G$50,"<"&G$3:G$50)),0)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Here's your file with these formulas implemented.
    Attached Files Attached Files

  23. #23
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Thank you. I'll try this out too.


    Sent from my iPad using Tapatalk

  24. #24
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Quote Originally Posted by Tony Valko View Post
    Here's my offering...

    Create the combined list...

    Enter this formula in G3 and copy down until you get blanks:

    =IFERROR(IF(ROWS(G$3:G3)>ROWS(A$3:A$30),INDEX(C$3:C$15,ROWS(G$3:G3)-ROWS(A$3:A$30)),INDEX(A$3:A$30,ROWS(G$3:G3))),"")
    Very slick formula.....and simple! I couldn't figure out how to deal with zero's / empty cells.

  25. #25
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    ______

  26. #26
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Quote Originally Posted by Tony Valko View Post
    Here's my offering...

    Create the combined list...

    Enter this formula in G3 and copy down until you get blanks:

    =IFERROR(IF(ROWS(G$3:G3)>ROWS(A$3:A$30),INDEX(C$3:C$15,ROWS(G$3:G3)-ROWS(A$3:A$30)),INDEX(A$3:A$30,ROWS(G$3:G3))),"")

    Create the sorted list...

    Enter this array formula** in E3 and copy down until you get blanks:

    =IFERROR(INDEX(G$3:G$50,MATCH(SMALL(IF(G$3:G$50<>"",COUNTIF(G$3:G$50,"<"&G$3:G$50)),ROWS(E$3:E3)),IF(G$3:G$50<>"",COUNTIF(G$3:G$50,"<"&G$3:G$50)),0)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    That is pretty slick! Thank you!!

  27. #27
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    You're welcome. Thanks for the feedback!

  28. #28
    Forum Contributor
    Join Date
    02-27-2004
    Location
    California, United States
    MS-Off Ver
    Excel 2016
    Posts
    315

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Tony - I was playing with your formulas and I found a way around having the references as fixed rows. I created three Names: Females, Males, and Alpha_Combine. In each of the Names I have defined the column lengths like this:

    Females
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Males
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Alpha_Combine
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then in column G I changed the formula to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In column E I changed the {Array} formula to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Thank you again... this is a very slick combination.

  29. #29
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Combine Two Columns of Names and Create Third Alphabetized Column

    Yes, dynamic ranges are great when you have a lot of data and you'll be adding to it on a regular basis.

+ 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. Alphabetized Per Column Data
    By lkurrt in forum Excel General
    Replies: 2
    Last Post: 09-19-2013, 11:20 AM
  2. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  3. Replies: 3
    Last Post: 11-08-2012, 09:29 PM
  4. Replies: 1
    Last Post: 10-22-2012, 11:09 PM
  5. Replies: 0
    Last Post: 07-31-2006, 12:13 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