+ Reply to Thread
Results 1 to 11 of 11

Count Unique Values Matching Criteria from Other Column

  1. #1
    Registered User
    Join Date
    07-01-2013
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Count Unique Values Matching Criteria from Other Column

    I seek to count how many unique values from column A exist that match a value from column P-- so that I can tell how many unique inventory ID numbers exist that match inventory codes for different criteria.

    I have tried
    =countifs('July Orders'!$A:$A,(Match('July Orders'$A:$A,'July Orders'$A:$A,0)),'July Orders'!$P:$P,"01*")

    but that doesn't work.

    Any advice would be greatly appreciated!

  2. #2
    Registered User
    Join Date
    07-01-2013
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Count Unique Values Matching Criteria from Other Column

    And--not to complicate things, but I also would have call for a conditional count for unique values in $A:$A if $P:$P="29*" AND $C:$C<>{"*Bread*" ,"*Pizza*"}

  3. #3
    Registered User
    Join Date
    07-11-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Count Unique Values Matching Criteria from Other Column

    can you make an example spreadsheet with what the data looks like as well as the expected output?

    I think it is going to be something similar to

    =COUNTIFS('July Orders'!$A:$A,P#) where P# is the cell in column P that you are trying to match to.

  4. #4
    Registered User
    Join Date
    07-01-2013
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Count Unique Values Matching Criteria from Other Column

    Book1.xlsx

    I tried the formula shown above and it returned a value of 0--whereas the correct formula should return a value of 2 (DD70059 and DD70231 are unique item codes listed as being "01-Non-Foods" in column P)

  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: Count Unique Values Matching Criteria from Other Column

    Try this array formula**:

    A10 = 01-Non-Foods

    =SUM(IF(FREQUENCY(IF(P2:P8=A10,MATCH(A2:A8,A2:A8,0)),ROW(A2:A8)-ROW(A2)+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.

  6. #6
    Registered User
    Join Date
    07-01-2013
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Count Unique Values Matching Criteria from Other Column

    The source data actually consists of x>=1,000 rows of data and ~30 categories--and may be sorted or filtered at any time. Though I'm not entirely clear the role that the ROW function plays in this formula, I believe it would be thwarted if the first instance of P="01*" showed up in row 576--or if you don't necessarily know what row it shows up in (because that may change if the data is re-sorted).

    The fact that data may be sorted doesn't necessarily matter for using IF($P:$P=A10 as a static cell can be created to reflect the value sought.

    And--also--how/ would this work when the determining factor is if A?="29*" and C?={"*Bread*","*Pizza*"}?

    Thanks,
    Jsharrard

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

    Re: Count Unique Values Matching Criteria from Other Column

    Quote Originally Posted by jsharrard View Post
    The source data actually consists of x>=1,000 rows of data and ~30 categories--and may be sorted or filtered at any time.
    The formula I suggested will not work on filtered data.

    Though I'm not entirely clear the role that the ROW function plays in this formula, I believe it would be thwarted if the first instance of P="01*" showed up in row 576--or if you don't necessarily know what row it shows up in (because that may change if the data is re-sorted).
    No, the ROW function will not be thwarted if the data is sorted.

    And--also--how/ would this work when the determining factor is if A?="29*" and C?={"*Bread*","*Pizza*"}?
    Perhaps you should tell us everything you want to do and post an updated sample file that shows us what results you expect.

  8. #8
    Registered User
    Join Date
    11-16-2013
    Location
    Angola
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique Values Matching Criteria from Other Column

    Hi!
    Need help please!
    I want to create countifs formula to count how many unique PO's was issued for each buyer for 2012 with status Completed.

    Countifs works fine but my problem is nesting a formula to determine only unique values.

    Here below are sample table.

    BUYER PO DATE STATUS
    GOPA 692735 11/05/2012 Completed
    GOPA 692090 13/10/2012 Completed
    GOPA 706391 18/04/2012 Partially completed
    CRIZ 697459 19/04/2012 Partially completed
    CRIZ 697459 26/04/2012 Completed
    CRIZ 697459 04/05/2012 Completed
    CRIZ 697459 10/12/2012 Completed
    CRIZ 697459 23/01/2013 Completed
    CRIZ 697459 15/11/2012 Completed
    CRIZ 697459 16/10/2012 Not compl.
    CRIZ 697459 26/06/2013 Completed
    CRIZ 697459 06/12/2012 Completed
    CRIZ 696494 30/04/2013 Completed
    CRIZ 742422 04/12/2012 Completed
    GOPA 704663 24/04/2012 Completed
    GOPA 701281 24/04/2012 Completed
    GOPA 699192 07/09/2012 Completed
    CRIZ 700892 12/06/2012 Completed
    CRIZ 695038 26/04/2012 Completed
    CRIZ 695020 24/05/2012 Completed
    CRIZ 698305 04/11/2013 Completed
    CRIZ 698318 04/11/2013 Partially completed
    GOPA 698281 18/12/2012 Partially completed
    GOPA 730951 05/10/2012 Completed
    CRIZ 695524 09/10/2012 Partially completed

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

    Re: Count Unique Values Matching Criteria from Other Column

    I think you have to start your own thread (forum rules?).

    Start your own thread and I'll be happy to help!

  10. #10
    Registered User
    Join Date
    11-16-2013
    Location
    Angola
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Count Unique Values Matching Criteria from Other Column

    Thanks! I had posted a new thread...

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

    Re: Count Unique Values Matching Criteria from Other Column

    I see it and have replied!

+ 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