+ Reply to Thread
Results 1 to 6 of 6

Count If without counting duplicates?

  1. #1
    Registered User
    Join Date
    07-05-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Count If without counting duplicates?

    Hello,

    I need a bit of help. I need a formula/function for this, no VBA please.

    I have column D with my sales agents, and then another column B with their clients. This list shows multiple transactions with their same clients but I only want to count one occurrence of a client, not duplicates. So I want to count how many clients they have even though, they may have the same client showing multiple times. I need a formula only please.

    Example:

    Client Sales Agent
    Mark Alex
    Sam Alex
    Kim Kate
    Mark Alex
    Brian Kate


    In this case the formula should return 2 for Alex, and 2 for Kate.

    I use Excel 2007. Thanks!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Count If without counting duplicates?

    With your sample data in A1:B6
    and
    Col_D containing Sales Agent names
    D1: Alex
    D2: Kate

    This regular formula returns the count of unique client names for that Sales Agent
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy that formula down as far as you need.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    07-05-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Count If without counting duplicates?

    Thanks for your help with this! I'm sorry I am a bit confused...let me try to clarify my situation:

    Column A is empty. Column B starting in cell B2 down to about B1000 has a list of all client names including duplicates if there were multiple transactions. (I have many more client names than in my example)
    Column D2 down to about D1000 has the list of the sales agent names. (I have more than just Alex and Kate, I have about 20+ different agents)

    Does this clarify it better?

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Count If without counting duplicates?

    Since many people post examples that don't quite match their actual scenario, I posted a generic example that I thought you might be able to tweak to suit your situation.

    Now that we know what you're actually using...
    With
    D2:D1000 containing Sales Agent names
    and
    B2:B1000 containing Client names
    AND
    F1:F20 containing the names of each Sales Agent

    This regular formula begins the list of unique client counts per sales agent
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy that formula down through G20.

    Does that help?

  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 If without counting duplicates?

    One way...

    If this is your data in the range A2:B6...

    Mark......Alex
    Sam......Alex
    Kim.......Kate
    Mark.....Alex
    Brian.....Kate

    List the unique agent names in a range of cells:

    D2= Alex
    D3 = Kate

    Then, enter this array formula** in E2 and copy down:

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

    You can easily generate the list of unique agent names using advanced filter:

    http://contextures.com/xladvfilter01.html#FilterUR
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    07-05-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Count If without counting duplicates?

    This worked perfectly, thanks so much Ron!

+ 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