+ Reply to Thread
Results 1 to 9 of 9

How to get the number of unique references for a particular item

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    How to get the number of unique references for a particular item

    Hi,

    I have a table with several columns. Two of these columns (that are not consecutive) are similar to this:

    Item Reference
    Apple 123456
    Apple 456789
    Lemon 123456
    Lemon 123456

    I need a formula (located in a different sheet) that gives me the number of unique references for a particular item. For instance, the answer for Apple would be 2, and the answer for Lemon would be 1.

    I've tried several conbinations of Count.if and Count.ifs but no result.

    Thanks in advance,

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to get the number of unique references for a particular item

    IN C1, put this and copy down.

    =SUMPRODUCT(($A$1:A1=A1)*($B$1:B1=B1))

    Then use this one to get your result.

    =SUMPRODUCT((A1:A4="Apple")*(C1:C4=1))

    =SUMPRODUCT((A1:A4="Lemon")*(C1:C4=1))
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to get the number of unique references for a particular item

    with an pivot table?
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: How to get the number of unique references for a particular item

    Can't do Pivots either. Only a formula for each particular item on its right.

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to get the number of unique references for a particular item

    why can't you do Pivot's ??

  6. #6
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: How to get the number of unique references for a particular item

    Fotis, SumProduct on that operation requires to copy the formula on each line of the table. And it contains thousands of records. It would slow dramatically the sheet.
    The number of items is les than hundred, so I need a formula to apply to each of these hundred, on other sheet.

  7. #7
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to get the number of unique references for a particular item

    We can use Countifs and no sumproduct. Ii will be much more better.

    Something like this.

    =COUNTIFS($A$1:A1,A1,$B$1:B1,B1)--Not Tested, because Just now i am in a Laptop using Excel 2003.

    Never mind if your result will be in other sheet.

    First formula in column C-this will be a helper and hidden if you like column-is important to get your result.

    If you like, upload a small sample workbook.

  8. #8
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: How to get the number of unique references for a particular item

    Well, yes, but I would prefer not to use the main sheet for any operation. Your solution implies to add some columns on the main sheet, what I would do if there is not any other alternative.

  9. #9
    Registered User
    Join Date
    10-24-2012
    Location
    Europe
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: How to get the number of unique references for a particular item

    Hi,
    Solution found:

    {=SUM(IF(FREQUENCY(IF(A$1:A$4=D1,B$1:B$4),B$1:B$4)>0,1))}

    Thanks all for your help

+ 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