• Count unique text values in a range (Excel 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Count unique text values in a range (Excel 2000)

    Author
    Topic
    #369815

    How do I count the number of UNIQUE text values in a range? For example, cells A1 through A5 have the following values: apples, apples, oranges, peaches, bananas. The count of unique text values is 4. What kind of formula can I use to get this calculation?

    Any help is much appreciated. Thanks.

    Viewing 0 reply threads
    Author
    Replies
    • #583223

      If there ane no blank cells in A1 thru A5, then the formula is not too bad:

      {=SUM(1/COUNTIF(A1:A5, A1:A5))}

      where the braces are placed there by Excel as you enter this as an array formula (press Ctrl-Shift-Enter instead of Enter)

      If there can be blanks, then it is even stranger

      {=SUM(IF(COUNTIF(A1:A5,A1:A5)=0, "", 1/COUNTIF(A1:A5,A1:A5)))}

      again entered as an array formula.

      No, I’m not the genius, this is all on John Walkenbach’s site j-walk.com –Sam

      • #583226

        You’re a doll, even if you did get it from j-walk.com.
        Thanks,
        Linda

      • #583239

        In case of (formula-generated) blanks I’d suggest using:

        =SUM(IF(LEN(A1:A5),1/COUNTIF(A1:A5,A1:A5)))

        array-entered of course.

        The particular use of COUNTIF is an invention of David Hager. Enforcing it with the LEN test originates from my efforts in fighting the formula-generated blanks.

        Aladin

    Viewing 0 reply threads
    Reply To: Count unique text values in a range (Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: