+ Reply to Thread
Results 1 to 14 of 14

Combine two columns in a third collumn, maintaining order

  1. #1
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Combine two columns in a third collumn, maintaining order

    I have two columns

    A B
    1
    2
    3
    5 4
    6
    7
    8 9

    How can I combine these two columns while keeping the order? I need it to be done with a formula or macro so it can be done seamlessly, and keep working with new data sets.
    Attached Files Attached Files
    Last edited by connor2290; 07-23-2019 at 01:45 PM.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Combine two columns in a third collumn, maintaining order

    Could you define "combine these two columns while keeping the order"? Can you give an example of what you want as a result? Are the entries all unique or could there be duplicates?

    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Re: Combine two columns in a third collumn, maintaining order

    the ideal result looks like this. Consolidate the two columns into one, if a value is in the second column, it needs to go directly above or below its adjacent entry. There some duplicates, but I want them to stay. I am consolidating two lists of employees that are grouped by branch.
    1
    2
    3
    4
    5
    6
    7

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Combine two columns in a third collumn, maintaining order

    Based on the file attached to post #1, try pasting the following formula into cell K2 and dragging the fill handle down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Contributor
    Join Date
    10-30-2003
    Location
    Singapore
    MS-Off Ver
    Excel 2019
    Posts
    197

    Re: Combine two columns in a third collumn, maintaining order

    Or,

    In G2, copied down :

    =IF(ROWS($1:1)<=COUNT(E$2:F$100),SMALL(E$2:F$1100,COUNTIF(E$2:F$100,"<="&G1)+1),"")

    Regards
    Bosco

  6. #6
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Re: Combine two columns in a third collumn, maintaining order

    Your formula works with numbers, but I am using text. I'm using this for a list of names

  7. #7
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Re: Combine two columns in a third collumn, maintaining order

    Thank you for responding. The formula you gave works for numbers, but not a list of names....probably should have stated that

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Combine two columns in a third collumn, maintaining order

    It may help if you upload another file that is more closely representative of your actual needs. Remember to manually include the expected results so that contributors will have something against which to compare their formulas/code.
    Let us know if you have any questions.

  9. #9
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Re: Combine two columns in a third collumn, maintaining order

    Okay, I have updated the attachment to be more clear

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Combine two columns in a third collumn, maintaining order

    Using the following array entered formula* produces the same list as that manually placed in A3:A17 on the desired result sheet, with the exception that Kate is placed before Bob, however since Robin had been placed before Steve and Max before Chadd, I don't feel that is an issue.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    *Array entered formulas are 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.
    Let us know if you have any questions.

  11. #11
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Re: Combine two columns in a third collumn, maintaining order

    We're so close. Is there a way this can work indefinitely? I need it working for a list with hundreds of entries

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Combine two columns in a third collumn, maintaining order

    Quickest way would be to change the 14's to 1000's as in: =IFERROR(INDIRECT(TEXT(SMALL(IF((B$3:C$1000<>""),ROW(A$3:A$1000)*100+COLUMN(B$1:C$1),10^10),ROWS(A$1:A1)),"R0C00"),)&"","")
    Remember to only have the first cell in the output range selected when you make the modification, simultaneously press the Ctrl, Shift and Enter key to activate, then copy down the column.
    Let us know if you have any questions.

  13. #13
    Registered User
    Join Date
    07-18-2019
    Location
    Tampa, Florida
    MS-Off Ver
    2016
    Posts
    8

    Re: Combine two columns in a third collumn, maintaining order

    Works beautifully, thanks so much for your help

  14. #14
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Combine two columns in a third collumn, maintaining order

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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. Replies: 2
    Last Post: 06-15-2018, 11:43 AM
  2. [SOLVED] Combine two columns of alphanumeric data into one, with no duplicates, in descending order
    By Teaorchid in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-24-2015, 11:32 PM
  3. combine multiple cells into new cell maintaining font format
    By venturu in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-23-2015, 07:31 AM
  4. [SOLVED] Find a collumn in a dynamic sheet and select the entire collumn
    By Armand0 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2014, 11:20 AM
  5. [SOLVED] How can I combine Multiple Sheets in One Mastersheet while maintaining the Header Data
    By Sjoerd33 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-15-2013, 06:43 PM
  6. [SOLVED] How do I merge or combine 2 excel worksheets by a common collumn?
    By Phil330 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2006, 11:22 AM
  7. [SOLVED] Maintaining a default worksheet order
    By Graham in forum Excel General
    Replies: 4
    Last Post: 02-21-2005, 05: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