+ Reply to Thread
Results 1 to 2 of 2

Way to speed up countifs using VBA?

  1. #1
    Registered User
    Join Date
    11-09-2010
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    32

    Way to speed up countifs using VBA?

    Hi,

    Thanks in advance for any help!

    I have two large sheets of data in the format:
    PHP Code: 
              2010  2011  2012
    Person A    1   2   3
    Person B    0   3   3
    Person C    4   7   8
    Person D    5   6   6 
    etc 
    I've attached a simple example workbook.

    The same cell on each of the data sheets refers to the same individual in that given year. The numbers are codes for two different characteristics (Qualifications & years experience).

    At the moment I am using the Countifs() formula on a third sheet to count how many people meet each of the criteria (i.e. how many people in 2010 have a 1 from the qualifications sheet AND 1 year of experience from the experience sheet, how many have a 1 AND a 2 etc)

    This works fine but the problem is that I have 30 years (i.e. columns) and the number of rows is variable and dynamic (it could be up to 50,000 - representing 50,000 individuals). This is making the countifs formula VERY slow - it basically makes the workbook crash whenever I try to calculate.

    So, is there a way to do all of this in VBA? I'm thinking a macro that would read the data from sheet 1 and sheet 2, perform the Countifs() function and then output that data onto a third sheet (it would be fine if I had to run this macro any time the data changed).

    Again, thanks for any help.

    Cheers,
    Gareth
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Way to speed up countifs using VBA?

    Inbuilt Excel Functions are generally faster than VBA
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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