+ Reply to Thread
Results 1 to 6 of 6

Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

  1. #1
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

    Hia all,

    in the attached workbook, you can see (if you follow that mess of cell formulas) that I have been using a combination of COUNTIFS, SUMIFS, COUNTIF and SUM to arrive at the figures of 11 training sessions in which a total of 145 people attended. I noticed that this can take a varied amount of time - on my work machine (which is where I'll be using this workbook), it can take 10-15secs to recalculate for each new row that's added to the sheet "Attendances" - on my home supercomputer, it takes about 3-5 secs to recalculate - I can only imagine that this will get worse as the database grows?

    So, what I'm wondering is this...

    a. would a single array formula be able to accomplish the same outcome and if so, would someone be willing to show me how it should be written?
    b. would vBa coding be able to do the same and again, would someone be willing to show me how?
    c. which would be the faster of the two methods?

    Ideally, given the wealth of knowledge I've seen here, an example of both, if possible, would be great - however, I'm not in a position to negotiate, lol, so I'll take whatever advice anyone can offer.

    Cheers,

    AJ
    Attached Files Attached Files
    Last edited by ScotyB; 07-19-2012 at 09:49 PM. Reason: To mark as SOLVED - thanks, guys.
    Always grateful for the help here - thanks.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

    here's a formula method.
    Attached Files Attached Files
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

    Joseph,

    thank you very much - I don't think I could ever have come up with that array formula on my own - I'll test it against my bigger database at work tonight and get back to you if there's any problems.

    Thank you again, much appreciated.

    Cheers,

    AJ

  4. #4
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

    Joseph,

    just confirming that the code hasn't given me any problems, so, thanks again - I'll now mark this as solved.

    Cheers,

    AJ

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

    For those who can't download or can't view newer version files, JosephP's array formula is:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    08-04-2010
    Location
    Adelaide, Australia
    MS-Off Ver
    Office 365
    Posts
    176

    Re: Array Formula vs vBa code - How To Modify My Messy Code To One Of Those

    Thanks, Cutter - I'll remember to do that next time.

    Cheers,

    AJ

+ 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