+ Reply to Thread
Results 1 to 6 of 6

Formula Optimization on several Countifs formulas

  1. #1
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Formula Optimization on several Countifs formulas

    Hello, I am using the formula below to count the instances of two text strings in a column of data with roughly 12,000 entries. My conundrum is that I need to add about 10 more text strings to this formula. Can anyone suggest a better way?

    =IFERROR(COUNTIFS(DM_IssuesIssueText,"*"&"Clogged"&"*",DM_IssuesVPO,corpselect,DM_IssuesMonth,B190,DM_IssuesYear,prevyear)+COUNTIFS(DM_IssuesIssueText,"*"&"Dirty"&"*",DM_IssuesVPO,corpselect,DM_IssuesMonth,B190,DM_IssuesYear,prevyear),NA())

    Thanks in advance for any help you can provide.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Formula Optimization on several Countifs formulas

    How about:

    =SUM(COUNTIFS(DM_IssuesIssueText,"*" & {"Clogged","Dirty"} & "*",DM_IssuesVPO,corpselect,DM_IssuesMonth,B190,DM_IssuesYear,prevyear))

    Confirmed with Ctrl-Shift-Enter, not just Enter

  3. #3
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Re: Formula Optimization on several Countifs formulas

    Andrew, when using your formula, it gives me an error highlighting "Clogged" as the source of the error. I do like the direction you are going as it would be quite simple to add the keywords I am searching for to the list.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Formula Optimization on several Countifs formulas

    There was a stray quote in my original formula, which I edited out - have you removed it from your formula as well?

  5. #5
    Forum Contributor
    Join Date
    02-16-2008
    Location
    Mansfield, TX
    Posts
    324

    Re: Formula Optimization on several Countifs formulas

    Andrew, the formula works brilliantly now. Because I am curious now, can you think of any way to substitute the {"Clogged","Dirty"} with a reference to a dynamically named range of cells? This would allow my users to add and subtract words at will, and allow me to hide the formulas away from prying eyes and certain doom.

  6. #6
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Formula Optimization on several Countifs formulas

    Yes, on a hidden sheet, or similar, create a list of the search terms. Give the range of cells a name, perhaps "keywords" and modify the formula to:

    =SUM(COUNTIFS(DM_IssuesIssueText,"*" & Keywords & "*",DM_IssuesVPO,corpselect,DM_IssuesMonth,B190,DM_IssuesYear,prevyear))

    Making sure to still use Ctrl-Shift-Enter to enter it into the cell.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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