Results 1 to 11 of 11

Formula to return unique values in a range in alphabetical order - explanation needed.

Threaded View

  1. #1
    Registered User
    Join Date
    06-10-2013
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    20

    Question Formula to return unique values in a range in alphabetical order - explanation needed.

    Hi Everyone,

    Assume we have a list of letters/words in A2:A11 and we want to show in B2 and down all unique values from A2:A11 in alphabetic order. This can be achieved using in B2 this array-entered formula: =INDEX($A$2:$A$11,MATCH(0,COUNTIF($A$2:$A$11,"<"&$A$2:$A$11)-SUM(COUNTIF($A$2:$A$11,"="&B$1:B1)),0))

    I tried to figure out how this formula works but I couldn't. I understand this part only COUNTIF($A$2:$A$11,"<"&$A$2:$A$11). COUNTIF($A$2:$A$11,"="&B$1:B1)) seems to be a circular reference to me and I have no idea how to crack this formula from here...

    I managed to write a formula that will do A-Z sorting but listing all values, duplicates will be included - arrayed entered in:
    =INDEX($A$2:$A$11,MATCH(SMALL(COUNTIF($A$2:$A$11,"<"&$A$2:$A$11),ROW()-1),COUNTIF($A$2:$A$11,"<"&$A$2:$A$11),0))

    and I manged to write a formula that will return unique values in alphabetical order, but using one extra helping column:
    helping formula in D2: =IF(COUNTIF(A2:$A$11,A2)>1,"x",COUNTIF($A$2:$A$11,"<"&$A$2:$A$11))
    final formula - array entered: =INDEX($A$2:$A$11,MATCH(SMALL(COUNTIF($A$2:$A$11,"<"&$A$2:$A$11),ROW()-1),$D$2:$D$11,0))

    If anyone could help me with the folloing question that would be great:

    1) Please explain step by step how the original formula works

    2) I wrote a formula that will return exactly the same result as original formula, but I need to use a helping column. Why nesting the helping coulmn into the final formula doesn't work the same way as keeping both formulas separate? The final formula will look like that - array entered: =INDEX($A$2:$A$11,MATCH(SMALL(COUNTIF($A$2:$A$11,"<"&$A$2:$A$11),ROW()-1),IF(COUNTIF(A2:$A$11,A2)>1,"x",COUNTIF($A$2:$A$11,"<"&$A$2:$A$11))))
    And it almost works, except it returns error for duplicated values. Any idea how to fix it?

    3)How come COUNTIF($A$2:$A$11,"<"&$A$2:$A$11) expression entered in let's say H2:H11 returns different values for different rows? The formula looks exactly the same in each cell, all references are absolute.

    Thanks
    tmk221
    Attached Files Attached Files
    Last edited by tmk221; 06-12-2013 at 02:46 PM. Reason: I uploaded worksheet with my inputs

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