+ Reply to Thread
Results 1 to 5 of 5

Countifs Unique values by month

Hybrid View

bbrunof13 Countifs Unique values by... 03-05-2015, 08:03 PM
azumi Re: Countifs Unique values by... 03-05-2015, 08:40 PM
Tony Valko Re: Countifs Unique values by... 03-05-2015, 08:40 PM
bbrunof13 Re: Countifs Unique values by... 03-06-2015, 11:55 AM
Tony Valko Re: Countifs Unique values by... 03-06-2015, 02:40 PM
  1. #1
    Registered User
    Join Date
    03-05-2015
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2013
    Posts
    7

    Countifs Unique values by month

    Situation: I have a long list of stock number is column A, in which I know there are many duplicates, and the related month in column B. I want to count the unique stock numbers in column A for each month in column B. Example:

    A B
    1A Jan
    1A Feb
    1B Feb
    1A Jan
    1B Feb
    2C Feb
    2A Jan
    1C Jan
    2C Feb

    I would want January and February to return a count of 3. I can use {=SUM(1/COUNTIF(A1:A10,A1:A10)} to count unique values in A but cannot figure out how to add in the month qualifier.

    Thanks!

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

    Re: Countifs Unique values by month

    Maybe like this:

    =SUM(IF(FREQUENCY(IF(B1:B9="Jan",IF(A1:A9<>"",MATCH(A1:A9,A1:A9,0))),ROW(A1:A9)-ROW(A1)+1),1))

    array formula

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

    Re: Countifs Unique values by month

    Try this...

    Data Range
    A
    B
    C
    D
    E
    1
    1A
    Jan
    Jan
    3
    2
    1A
    Feb
    Feb
    3
    3
    1B
    Feb
    4
    1A
    Jan
    5
    1B
    Feb
    6
    2C
    Feb
    7
    2A
    Jan
    8
    1C
    Jan
    9
    2C
    Feb
    10
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in E1 and copied down:

    =SUM(IF(FREQUENCY(IF(B$1:B$9=D1,MATCH(A$1:A$9,A$1:A$9,0)),ROW(A$1:A$9)-ROW(A$1)+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.

  4. #4
    Registered User
    Join Date
    03-05-2015
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Countifs Unique values by month

    This worked, thank you both!

    Would you also happen to know how to expand the "IF" qualifiers? For example if I had a column C that also had a year and I wanted to count only 2013?

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

    Re: Countifs Unique values by month

    Maybe this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    1
    1A
    Jan
    2015
    2013
    2014
    2015
    2
    1A
    Feb
    2014
    Jan
    2
    1
    1
    3
    1B
    Feb
    2013
    Feb
    2
    2
    1
    4
    1A
    Jan
    2014
    5
    1B
    Feb
    2015
    6
    2C
    Feb
    2014
    7
    2A
    Jan
    2013
    8
    1C
    Jan
    2013
    9
    2C
    Feb
    2013
    10
    ------
    ------
    ------
    ------
    ------
    ------
    ------
    ------


    This array formula** entered in F2:

    =SUM(IF(FREQUENCY(IF($B$1:$B$9=$E2,IF($C$1:$C$9=F$1,MATCH($A$1:$A$9,$A$1:$A$9,0))),ROW(A$1:A$9)-ROW(A$1)+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.

    Copy across to H2 then down as needed.

+ 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. COUNTIFS unique values
    By Dan27 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-14-2014, 12:13 AM
  2. countifs for unique values
    By rbenguerel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-31-2014, 07:57 AM
  3. COUNTIFS criteria to specify unique values
    By Boatryte in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-17-2014, 04:05 PM
  4. COUNTIFS with Unique Values
    By lefteegunzz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-23-2013, 04:25 PM
  5. Excel 2007 : Using countifs to count unique values
    By AlexZoom in forum Excel General
    Replies: 2
    Last Post: 09-23-2010, 09:41 AM

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