+ Reply to Thread
Results 1 to 9 of 9

countif multiple criteria but ignore duplicates

  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    countif multiple criteria but ignore duplicates

    Hi kind excel community...I'm after your precious time to help me with formula to count the days the running activity was done and ignore the amount of times it might have been done in the same day. The count for distinct running days containing the word "Running" must equals 3 in the attached example table.

    Also, is this possible without using an array formula?

    Many many thanks in advance...
    Attached Files Attached Files

  2. #2
    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: countif multiple criteria but ignore duplicates

    Try this formula

    =SUMPRODUCT((ISNUMBER(SEARCH("Running",A3:A11))/COUNTIF(B3:B11,B3:B11)))
    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

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: countif multiple criteria but ignore duplicates

    I used a helper, and copied this down...
    =IF(COUNTIFS($A$3:A3,"run*",$B$3:B3,B3)=1,1,"")

    You can then just count the helper
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  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: countif multiple criteria but ignore duplicates

    Using your posted workbook....
    and
    B1: an activity to match....running

    this formula returns the unique dates containing that activity (Durable against blank cells)
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    Re: countif multiple criteria but ignore duplicates

    Thanks everyone for all your quick responses... you have helped me a great deal. Just what I asked for.

    Quote Originally Posted by AlKey View Post
    Try this formula

    =SUMPRODUCT((ISNUMBER(SEARCH("Running",A3:A11))/COUNTIF(B3:B11,B3:B11)))
    Alkey , your formula is correct but gave a blank error due to some blanks but I preferred you { search("Running" } bit of the formula which I added to Ron Coderre's formula below (which is the same as yours but blank proof hence it worked) to avoid referencing a cell.

    B1: an activity to match....running

    this formula returns the unique dates containing that activity (Durable against blank cells)
    Select Code copy to clipboard
    C1: =SUMPRODUCT(ISNUMBER(SEARCH(B1,A4:A22))/COUNTIF(B4:B22,B4:B22&""))
    Is that something you can work with?
    FDibbins, thanks for your input but I just need the formula in one fixed cell and my worksheet cannot accommodate the helper method. But thanks.

    So Both Alkey and Ron Coderre get kudos on this one... Rep added!!

  6. #6
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    Re: countif multiple criteria but ignore duplicates

    oh, and one more thing.... how do I add an additional condition of say year, probably by referencing a different cell.
    So how many days running activity happened in 2014?

    Thanks in advance..

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

    Re: countif multiple criteria but ignore duplicates

    Using your posted workbook
    and
    A1: a year....2015
    B1: an activity....Running

    Edited to replace a faulty formula with a correct one

    This ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER) returns the count of unique dates that satisfy those requirements:
    Please Login or Register  to view this content.
    Does that help?
    Last edited by Ron Coderre; 06-09-2015 at 09:50 AM.

  8. #8
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    Re: countif multiple criteria but ignore duplicates

    Quote Originally Posted by Ron Coderre View Post
    Using your posted workbook
    and
    A1: a year....2015
    B1: an activity....Running

    Edited to replace a faulty formula with a correct one

    This ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER) returns the count of unique dates that satisfy those requirements:
    Please Login or Register  to view this content.
    Does that help?
    Thanks Ron, work but as it's an array formula it's dramatically slowed down my workbook because my file look range is cells A3:A1048576... dynamic name ranges are not an option as the worksheet gets copied frequently which will creates multiple named ranges when that happens.

    is there any slight chance this is achievable without an array like your previous formula??

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: countif multiple criteria but ignore duplicates

    FDibbins, thanks for your input but I just need the formula in one fixed cell and my worksheet cannot accommodate the helper method.
    unlikely, but OK

    Thanks Ron, work but as it's an array formula it's dramatically slowed down my workbook because my file look range is cells A3:A1048576
    So reduce the range to just what you need - or at worst, 2-3 times what you think you would need

+ 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] Conditional format duplicates ignore certain criteria
    By spoursy in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 07-31-2014, 07:49 AM
  2. [SOLVED] Countif with multiple criteria and duplicates counted once
    By BPG420 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-26-2013, 10:58 PM
  3. Replies: 3
    Last Post: 05-23-2013, 07:50 PM
  4. Sum Countif formula but ignore duplicates
    By TiLa in forum Excel General
    Replies: 5
    Last Post: 01-12-2012, 04:22 AM
  5. Count first entries (ignore duplicates) against multiple criteria
    By Bazza in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-28-2008, 11:44 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