+ Reply to Thread
Results 1 to 7 of 7

(Simple) Unique Count - Formula problem

  1. #1
    Registered User
    Join Date
    11-05-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    9

    (Simple) Unique Count - Formula problem

    Hi,

    I'm having some difficulties creating a unique count formula. I am trying to look-up a supplier name against a data extract, and count the number of Categories they fall under.

    For example, the 2 fields I'm concerned with on the look-up table are:

    A B
    Supplier | Category

    A1| Extreme Sport | Event Services
    A2| Extreme Sport | Media Production
    A3| Extreme Sport | Media Production
    A4| One Media | Media Production


    IE. Extreme Sport would fall under 2 categories (Event Services & Media Production). On my report I need it to look like this:


    A B
    Supplier | Number of Categories

    A1| Extreme Sport | 2
    A2| One Media | 1


    However, I can't seem to find a way to use a COUNTIF that doesn't return the number lines, rather than the number of unique values. I was thinking about a INDEX/MATCH but imagine it will have the same problem.

    Any help would be greatly appreciated!

    Cheers
    Alan
    Last edited by AlanoR; 12-08-2014 at 12:58 PM.

  2. #2
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: (Simple) Unique Count - Formula problem

    Assumed your data in ranges A1:B4 based on your table, and you have criteria in A7 and A8 (Extreme Sport & One Media) , put this in B7:

    =SUM(($A$1:$A$4=$A7)/COUNTIFS($A$1:$A$4,$A$1:$A$4,$B$1:$B$4,$B$1:$B$4))

    and press CTRL+SHIFT+ENTER button together (array formula) and then copied down to A8

  3. #3
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    Re: (Simple) Unique Count - Formula problem

    Here is some code from Jerry B's site which wiil consolidate and merge making it easy for you to perform a count

    Please Login or Register  to view this content.
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: (Simple) Unique Count - Formula problem

    Are you looking for distinct or unique values?

  5. #5
    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: (Simple) Unique Count - Formula problem

    to get unique list for suppliers

    **Array formula in C2 and copy down

    =IFERROR(INDEX($A$2:$A$100,MATCH(0,IF(ISBLANK($A$2:$A$100),"",COUNTIF(C$1:$C1, $A$2:$A$100)), 0)),"")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    For count unique categories:

    In D2 and copy down

    =SUMPRODUCT(($A$2:$A$5=$C2)/COUNTIFS($A$2:$A$5,$A$2:$A$5,$B$2:$B$5,$B$2:$B$5&""))

    Row\Col
    A
    B
    C
    D
    1
    Supplier Category Unique Supplier Name Count
    2
    Extreme Sport Event Services Extreme Sport
    2
    3
    Extreme Sport Media Production One Media
    1
    4
    Extreme Sport Media Production
    5
    One Media Media Production
    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

  6. #6
    Registered User
    Join Date
    11-05-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    9

    Re: (Simple) Unique Count - Formula problem

    Hi Al,

    Thanks for formula. I was just wondering if you could explain a little further what the /COUNTIFS(...) does?

    Thanks again
    Alan

  7. #7
    Registered User
    Join Date
    11-05-2014
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    9

    Re: (Simple) Unique Count - Formula problem

    Just for distinct values, but AlKey's & Azumi's formula seems to Work.
    Cheers

+ 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] Unique Count Problem
    By vichisov in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 02-11-2014, 01:01 PM
  2. [SOLVED] Unique Count Problem x 3
    By sammymalta in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 02-04-2014, 11:18 AM
  3. [SOLVED] Unique List/Count Problem
    By pauldaddyadams in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 05-07-2013, 06:27 AM
  4. Replies: 6
    Last Post: 10-17-2012, 07:32 PM
  5. Simple Count problem
    By Paul987 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2006, 03:59 PM

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