+ Reply to Thread
Results 1 to 4 of 4

VBA to sum numbers based on week number

Hybrid View

  1. #1
    Registered User
    Join Date
    08-26-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    18

    VBA to sum numbers based on week number

    Hi, I have a monthly report like below showing daily scores, I'd like to know if there is a vba I can use to sum the weekly total every month. So basically the total of week 1, week 2...week 5.

    Date Score
    4/1/2012 2115
    4/2/2012 2492
    4/3/2012 2421
    4/4/2012 2297
    4/5/2012 2148
    4/6/2012 2037
    4/7/2012 3560
    .
    .
    .
    4/28/2012 2340
    4/29/2012 2188
    4/30/2012 2075

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA to sum numbers based on week number

    Hi,

    Yes, a VBA solution is of course possible but why complicate matters?

    You could use either a SUM() and then deduct with two SUMIF() functions the total before and after your week start and end dates, or alternatively a SUMPRODUCT() function using the same general idea but summing values between your start and end dates.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-26-2011
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: VBA to sum numbers based on week number

    yeah, I know how to use formula to get this, but I wanna use a VBA so I can generate the results to a table in a different file

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA to sum numbers based on week number

    Using a formula doesn't preclude you referring to a linked workbook. I'm not clear why you think a VBA solution is preferable.

+ 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