+ Reply to Thread
Results 1 to 7 of 7

COUNT unique values in A:A IF B:B = x

  1. #1
    Registered User
    Join Date
    04-15-2017
    Location
    Colchester, England
    MS-Off Ver
    Mac 2011
    Posts
    54

    COUNT unique values in A:A IF B:B = x

    Hey,

    I'm after a way to count unique values in a column with a criteria. Please see attached,
    Count Unique IF.xlsx

    Thanks!

    Callum
    Last edited by callummcgrath; 10-25-2017 at 07:46 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,661

    Re: COUNT unique values in A:A IF B:B = x

    Try this:

    =SUM(--(FREQUENCY(IF(B2:B1000=21,MATCH(A2:A1000,A2:A1000,0)),ROW(B2:B1000)-ROW(B2)+1)>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.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: COUNT unique values in A:A IF B:B = x

    .... or another possibility: an ordinary formula:

    =SUM(INDEX(($B$2:$B$28=21)/COUNTIFS($B$2:$B$28,$B$2:$B$28,$A$2:$A$28,$A$2:$A$28),0))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2021
    Posts
    5,984

    Re: COUNT unique values in A:A IF B:B = x

    Or:

    =SUM(IF(C2:C33=F2,1/COUNTIFS(A2:A33,A2:A33,C2:C33,F2)))

    CTRL+SHIFT+ENTER

  5. #5
    Registered User
    Join Date
    04-15-2017
    Location
    Colchester, England
    MS-Off Ver
    Mac 2011
    Posts
    54

    Re: COUNT unique values in A:A IF B:B = x

    All 3 of you are amazing, each of them worked perfectly.

    Thank you!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,661

    Re: COUNT unique values in A:A IF B:B = x

    You're welcome!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,427

    Re: COUNT unique values in A:A IF B:B = x

    I should add that mine has one drawback. It needs the ranges to be exact. So, if you go with it... it's advisable either to use a fixed (exact) range or to use a dynamic named range to auto-adjust the ranges chosen by the formulae. Do you know how to set these up? Are the values in columns A & B direct entries, or are they the result of other formulae?

+ 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. Create a unique list with a count against the unique values
    By barber87 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-12-2017, 10:13 AM
  2. Replies: 2
    Last Post: 08-19-2015, 10:22 AM
  3. [SOLVED] Count then Delete Duplicate Values and put count next to now unique value
    By flipjarg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2014, 04:22 PM
  4. [SOLVED] Unique Total Value Count per Unique Lookup Values
    By KnightVision in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-02-2014, 05:03 AM
  5. [SOLVED] count unique values based on unique values
    By neetu.aggarwal in forum Excel General
    Replies: 13
    Last Post: 10-23-2012, 04:00 AM
  6. [SOLVED] How To Count Unique Values in COL A Subject for each unique value in COL B ??
    By amirtehrani in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-06-2012, 03:00 AM
  7. Replies: 17
    Last Post: 08-24-2009, 08:58 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