+ Reply to Thread
Results 1 to 4 of 4

Unique Values Based on Text

  1. #1
    Registered User
    Join Date
    08-23-2010
    Location
    Spring Arbor, MI
    MS-Off Ver
    Excel 2007
    Posts
    2

    Unique Values Based on Text

    Formula:
    =SUMPRODUCT((RIGHT(B1:B10,5)="(a4) ")*((A1:A10<>"")/COUNTIF(A1:A10,A1:A10&"")))

    Please Login or Register  to view this content.

    I want to get the number of unique values in column A, based on the RIGHT text of column B. In this particular example it should be 4, however that formula is returning 4.5. I believe this is because "c" is in column A twice, but should only be counted once for RIGHT, 5 = "(a4) ". Any help is appreciated!
    Last edited by Ona; 08-24-2010 at 09:40 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Unique Values Based on Text

    Try:

    =COUNT(1/FREQUENCY(IF(RIGHT(B1:B10,5)="(a4) ",IF(A1:A10<>"",MATCH(A1:A10,A1:A10,0))),ROW(A1:A10)-ROW(A1)+1))

    confirmed with CTRL+SHIFT+ENTER not just ENTER, although I am not sure why you are using Right(B1:B10,5)... is there other text in those B cells before the (A4)? If not, then maybe trim will work to get rid of trailing space...

    e.g.

    =COUNT(1/FREQUENCY(IF(TRIM(B1:B10)="(a4)",IF(A1:A10<>"",MATCH(A1:A10,A1:A10,0))),ROW(A1:A10)-ROW(A1)+1))
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: Unique Values Based on Text

    FWIW, the SUMPRODUCT equivalent would be:

    Please Login or Register  to view this content.
    though I make 5 unique values for "(a4) " in the sample data set (a,b,c,d,e)
    (the 4.5 results from c being apportioned by 2 given 2 instances thereof)

  4. #4
    Registered User
    Join Date
    08-23-2010
    Location
    Spring Arbor, MI
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Unique Values Based on Text

    Quote Originally Posted by DonkeyOte View Post
    FWIW, the SUMPRODUCT equivalent would be:

    Please Login or Register  to view this content.
    though I make 5 unique values for "(a4) " in the sample data set (a,b,c,d,e)
    (the 4.5 results from c being apportioned by 2 given 2 instances thereof)
    You are correct, it should have been 5 unique values with "(a4) ". I appreciate both of you for helping me with this, thank you very much! :D

+ 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