+ Reply to Thread
Results 1 to 8 of 8

Extracting Unique Values From a List...using formula

  1. #1
    Registered User
    Join Date
    04-15-2013
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Extracting Unique Values From a List...using formula

    first, thanks in advance for any help. I searched through as many threads to see if this was already answered, but no luck.

    I have a list of values in column A :

    apple
    plum
    orange
    melon
    apple
    apple
    orange
    banana


    In other sheet there is other list ( column B) :

    plum
    apple
    strawberry
    peach


    I want to know how many unique values are in column A that are present in column B:
    So the result of formula should be : 2
    ( apple, plum )

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting Unique Values From a List...using formula

    Try this formula
    in B2 and copy it down

    =LOOKUP("zzzz",CHOOSE({1,2},"",INDEX($A$2:$A$9,MATCH(0,INDEX(COUNTIF($B$1:B1,$A$2:$A$9),,),))))

    A
    B
    2
    apple apple
    3
    plum plum
    4
    orange orange
    5
    melon melon
    6
    apple banana
    7
    apple
    8
    orange
    9
    banana


    or if you just want to count unique values in column A use formula below

    =SUMPRODUCT((A2:A30<>"")/COUNTIF(A2:A30,A2:A30&""))
    Last edited by AlKey; 07-24-2014 at 05:28 PM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Registered User
    Join Date
    04-15-2013
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Extracting Unique Values From a List...using formula

    AlKey, thank you for replay, but I'm searching for something different.

    I want to count unique values in column A, but only those which are also in column B. The result of formula should be : 2
    I'm combining different functions ( SUMIF, COUNIFS, MATCH, INDEX, SUMPRODUCT, FREQUENCY ) for two days with no luck.

    Link to XLSX file :
    https://drive.google.com/file/d/0Bws...it?usp=sharing

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting Unique Values From a List...using formula

    Try this then

    =SUMPRODUCT((A1:B30<>"")/COUNTIF(A1:B30,A1:B30&""))-SUMPRODUCT((A1:A30<>"")/COUNTIF(A1:A30,A1:A30&""))

  5. #5
    Registered User
    Join Date
    04-15-2013
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Extracting Unique Values From a List...using formula

    Thank AlKey, I was happy for a moment - the result was good, but then I added some values to column B and the your formula was not working with additional data.
    Attached Files Attached Files

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting Unique Values From a List...using formula

    Try this...

    Data Range
    A
    B
    C
    D
    1
    apple
    peach
    ------
    4
    2
    plum
    plum
    3
    orange
    apple
    4
    melon
    strawberry
    5
    apple
    peach
    6
    apple
    apple
    7
    orange
    orange
    8
    banana
    banana


    This array formula** entered in D1:

    =SUM(IF(FREQUENCY(IF(ISNUMBER(MATCH(A1:A8,B1:B8,0)),MATCH(A1:A8,A1:A8,0)),ROW(A1:A8)-ROW(A1)+1),1))

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    04-15-2013
    Location
    Poland
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Extracting Unique Values From a List...using formula

    WOOOOOOW thank you Tony , this is exactly what I was looking for !!!

    You are my hero.

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Extracting Unique Values From a List...using formula

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Formula extracting unique column values
    By labogola in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-10-2013, 02:34 AM
  2. Extracting unique months form a long list of dates using array formula
    By Mian USman in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-30-2013, 09:54 AM
  3. Formula to Alphabatize unique values from a list
    By hcardiff in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2013, 03:32 PM
  4. Replies: 8
    Last Post: 12-30-2008, 12:06 PM
  5. Extracting unique values from live list
    By J.W. Aldridge in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2006, 10:10 AM

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