+ Reply to Thread
Results 1 to 4 of 4

concatenate cells in alphabetical order

  1. #1
    Registered User
    Join Date
    11-28-2009
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    2

    concatenate cells in alphabetical order

    How can I concatenate several cells into a new cell, but in alphabetical order?

    PART 1
    Example:

    Say I have a list of artists in cells A1 to E1

    For instance

    A1 = "Queen"
    B1 = "Santana"
    C1 = "Kraftwerk"
    D1 = "Oasis"
    E1 = "Barry Manilow"

    Can I make a formula that fills cell F1 with the five artists from A1:E1, but in alphabetical order?

    ie the succesful formula would give an output to cell F1 of "Barry Manilow, Kraftwerk, Oasis, Queen, Santana"

    ----------------------

    PART 2

    Same problem but this time I want the the five values to appear in alphabetical order in five new cells, from F1:J1

    So we would get:

    F1 = Barry Manilow
    G1 = Kraftwerk
    H1 = Oasis
    I1 = Queen
    J1 = Santana
    Last edited by Dr Paul; 11-28-2009 at 09:22 AM. Reason: didn't realise *** was a disallowed word. Santana for *** Pistols!

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: concatenate cells in alphabtical order? (in 2 PARTS)

    PART1 is far harder to achieve than PART2 .... both would realistically warrant use of helper cell... eg

    A2: =COUNTIF($A1:A1,A1)+COUNTIF($A$1:$E$1,"<"&A1)
    copied across to E2
    (the first COUNTIF is to handle duplicity should it arise)

    You can then use the output in Row 2 to determine output of F1:J1, ie

    F1: =INDEX($A$1:$E$1,MATCH(COLUMNS($F1:F1),$A$2:$E$2))
    copied across to J1
    (PART1 would then be a concatenation of the F1:J1)

    If you want to avoid helpers and/or achieve PART1 without PART2 then I would say you should be looking to use VBA as native functions aren't great at dealing with String Arrays.

  3. #3
    Registered User
    Join Date
    11-28-2009
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: concatenate cells in alphabtical order? (in 2 PARTS)

    Thanks DonkeyOte

    I don't understand INDEX, MATCH or even COUNTIF, so I just copied and pasted and this hasn't worked for me this time.

    I can see how it nearly works because the first formula has given numbers to the five names in correct order but then the output from F1:J1 looks like this:

    #N/A, Kraftwerk, Oasis, Barry Manilow, Barry Manilow

    I probably need to go and study these functions a bit.

    Attached...
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: concatenate cells in alphabtical order? (in 2 PARTS)

    Error all mine... typo in my original post ... should read:

    F1: =INDEX($A$1:$E$1,MATCH(COLUMNS($F1:F1),$A$2:$E$2,0))
    copied across

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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