+ Reply to Thread
Results 1 to 4 of 4

Unique Counts with Multiple Criteria Very Slow! Please Help.

  1. #1
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Unique Counts with Multiple Criteria Very Slow! Please Help.

    Hello,

    Any help would be appreciated.

    I have a workbook which processes and analyses 5k to 20k lines rows of data at a time through macros. Unfortunately, the macro runs very slowly (5-20 minutes)… Trying to find the bottleneck, I found that a couple of formulas are slowing everything down:
    The formulas which calculate unique instances of a combination of 'person', 'week', and 'area'. See below:


    Unique Persons and dates combinations only
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Unique Persons, dates, and area combinations
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Any way to make these more efficient? Or less resource intensive. I attached an example workbook in case it could help (Attachment HERE: uniqueCount.xlsx)
    I read that using SUMPRODUCT might be quicker but not by much, would VBA be better? I saw someone create a user defined function for something similar but it was too different from my situation for me to be able to use.

    Thanks,

    Goeff.

  2. #2
    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,926

    Re: Unique Counts with Multiple Criteria Very Slow! Please Help.

    1. wht the need for dymanic ranges? why not just use regular ranges?
    2. not sure if you need a unique count? I used this...
    =COUNTIFS($D$29:$D$3000,G29,$E$29:$E$3000,"<="&I29,$E$29:$E$3000,">="&H29)
    and this...
    =COUNTIFS($D$29:$D$5000,G29,$E$29:$E$5000,"<="&I29,$E$29:$E$5000,">="&H29,$C$29:$C$5000,$B$15)
    and got the exact same answers you did?
    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

  3. #3
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Unique Counts with Multiple Criteria Very Slow! Please Help.

    Thanks Ford. I wondered if that might do the trick, I tested it out in the original file and indeed I got the same numbers but then I realized from your following question that my example file was missing something important. See below.

    2. not sure if you need a unique count? I used this...
    'Persons' can have multiple entries per day and that wasn't reflected in the file. I modified the file so that the same dates appear more than once. I attached the new file here (ATTACHMENT: uniqueCount(corrected).xlsx ). I tried your formulas but they didn't work (Apologies for not getting it right the first time!)

    The reason I used dynamic ranges is because the length of data being processed is variable, could be 500 rows or 20k rows.

    Essentially what I am trying to end with are the unique number of days that a person's name appears during a week (or another date range), and sometimes needing to know this information only for a particular area.

    Do you see my problem? Any ideas?

    Thanks,

    Geoff.

  4. #4
    Forum Contributor
    Join Date
    04-30-2014
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Unique Counts with Multiple Criteria Very Slow! Please Help.

    Does anyone have any other suggestions?
    Thanks,
    Geoff.

+ 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. Formula that counts number of unique text values if it meets criteria
    By ruledwritingpaper in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-15-2014, 02:57 PM
  2. Formula that counts unique values within a criteria
    By GRACEROUHANA in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-03-2013, 01:20 PM
  3. [SOLVED] Multiple unique counts depending on other columns
    By gerainta in forum Excel General
    Replies: 2
    Last Post: 07-27-2012, 09:33 AM
  4. User-defined function, counts unique with criteria
    By cdiaz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2011, 04:18 PM
  5. Counts of unique values with multiple criteria
    By ChristiaanV in forum Excel General
    Replies: 4
    Last Post: 03-09-2011, 12:47 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