+ Reply to Thread
Results 1 to 4 of 4

Macro for adding between dates

  1. #1
    Registered User
    Join Date
    02-14-2005
    Posts
    69

    Question Macro for adding between dates

    Hi all,

    Here's hopefully an easy one for the macro gurus out there...

    I have several sheets that are then collated on a single "report" page. I would like to know if anyone out there has any idea on a macro or VBA module that would automatically sum totals with the criteria of start and end dates?

    The dates are added in manually each time the user wishes to update the report. Sometimes the start and end will be on a week by week and other times for a whole month.

    Help?????

  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    This can be done with a worksheet function. Do you really want a macro?

    see this application

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html
    not a professional, just trying to assist.....

  3. #3
    Registered User
    Join Date
    02-14-2005
    Posts
    69
    Hi Matey,

    No, can't really use the sumproduct function. There are too many variables to deal with. For a start I would need it to search for a matching date, then sum two or three different columns depending on the start and end dates. If sumproduct can do this, then can someone give me an example??

    I would rather have the user enter the dates and either use a button to re-calculate or VBA entered on the sheet itself which would automatically calculate. This way it leaves no room for the user to make any errors.

    Tar for the info though

  4. #4
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    let's say the start date is in cell a1, and the end date in cell a2, and you want to sum data in column C rows 1:100 between these dates in column B(inclusive of start and end dates).

    =sumproduct((b1:b100>=a1)*(b1+b100<=a2)*(c1:c100))

    to sum data in columns c:e

    =sumproduct((b1:b100>=a1)*(b1+b100<=a2)*(c1:e100))

+ 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