ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro for adding between dates (https://www.excelbanter.com/excel-programming/367298-macro-adding-between-dates.html)

rhani111[_14_]

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 VB
module that would automatically sum totals with the criteria of star
and end dates?

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

Help????

--
rhani11
-----------------------------------------------------------------------
rhani111's Profile: http://www.excelforum.com/member.php...fo&userid=1994
View this thread: http://www.excelforum.com/showthread.php?threadid=56173


duane[_76_]

Macro for adding between dates
 

This can be done with a worksheet function. Do you really want
macro?

see this application

http://www.xldynamic.com/source/xld.SUMPRODUCT.htm

--
duan

-----------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...fo&userid=1162
View this thread: http://www.excelforum.com/showthread.php?threadid=56173


rhani111[_15_]

Macro for adding between dates
 

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


--
rhani111
------------------------------------------------------------------------
rhani111's Profile: http://www.excelforum.com/member.php...o&userid=19940
View this thread: http://www.excelforum.com/showthread...hreadid=561737


duane[_77_]

Macro for adding between dates
 

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))


--
duane


------------------------------------------------------------------------
duane's Profile: http://www.excelforum.com/member.php...o&userid=11624
View this thread: http://www.excelforum.com/showthread...hreadid=561737



All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com