+ Reply to Thread
Results 1 to 9 of 9

Convert columns into unique rows

  1. #1
    Registered User
    Join Date
    04-04-2013
    Location
    los angeles
    MS-Off Ver
    Excel 2010
    Posts
    5

    Unhappy Convert columns into unique rows

    Hi there,
    I have a very peculiar question .
    I have data in columns that I need converted to rows with unique combinations.

    For eg: I have a row with 5 columns:
    A B C D E

    I need this converted into rows with 2 columns as follows:

    A B
    A C
    A D
    A E
    B C
    B D
    B E
    C D
    C E
    D E

    Has anyone done this before?? Please help!!

  2. #2
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: Convert columns into unique rows

    Copy row then paste special as "transpose".
    unique combinations mean? Please give clear example. Thanks

  3. #3
    Registered User
    Join Date
    04-04-2013
    Location
    los angeles
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Convert columns into unique rows

    thanks wenqq3. The transpose feature wont work. For eg
    if I have a row with 3 columns:
    NewYork LosAngeles Miami
    I want it converted into rows where one combination exists for each of the 3 cities.

    Ie -Final product:
    Row1 - NewYork LosAngeles
    Row 2 -NewYork Miami
    Row 3-LosAngeles Miami

    Hope I am making sense .

  4. #4
    Registered User
    Join Date
    03-24-2013
    Location
    Earth
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    81

    Re: Convert columns into unique rows

    Hi, RoxyParker07

    would you show us more examples , such like when data A...K ,A..C , the result will show ..
    look like need vba if you have more rows

  5. #5
    Registered User
    Join Date
    04-04-2013
    Location
    los angeles
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Convert columns into unique rows

    Yeah. I definitely have more rows. The number of columns will vary. For eg:
    Row -A B C D E F

    The output will be:
    AB
    AC
    AD
    AE
    AF
    BC
    BD
    BE
    BF
    CD
    CE
    CF
    DE
    DF
    EF

    Basically ,a unique combination of each of the data points. Does this help?

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,578

    Re: Convert columns into unique rows

    What you want is all permutations in sets of 2 for those x number of columns. Based on your example, AB is the same as BA so you wouldn't want that to appear twice, correct?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    04-04-2013
    Location
    los angeles
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Convert columns into unique rows

    Yes yes yes! You are absolutely correct. Preferably each permutation appears just once
    However, if it is easier to have both BA and AB combination appear then that should be ok too.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Convert columns into unique rows

    This should work. Just highlight a rows of values, any length, as long as they are adjacent in a row, then run this:
    Please Login or Register  to view this content.
    _________________
    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!)

  9. #9
    Registered User
    Join Date
    04-04-2013
    Location
    los angeles
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Convert columns into unique rows

    OMG! you are amazing. That did work. Thank you so so much. So very appreciated. You made my weekend

+ 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