LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Joe Blow
 
Posts: n/a
Default Macro to sum array by date


Hi,

I am having some trouble with this marco that I'm attempting. Hoping
someone could give me a hand. I am trying to sum an array based on a
date range.

Here is how I am passing info to the macro:

=accmgrsum(1/1/05,1/31/05,Bookings!D3:D7,Bookings!H3:H7)

Bookings being a worksheet. Bookings!D3:D7 are dates and
Bookings!H3:H7 are dollars.

Here is my marco:

Function accmgrsum(start_date, end_date, date_array, bookings_array)
accmgrsum = Application.Sum(IIf(date_array =
Application.DateValue("start_date"), IIf(date_array <=
Application.DateValue("end_date"), bookings_array, 0), 0))
End Function

Could someone let me know where I have gone wrong? I am not too well
versed on VBA as you can probably tell. Am I on the right track or is
there an easier way?

Thanks,
Joe
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert date in macro George Gee New Users to Excel 12 April 17th 06 05:44 AM
Date Overdue function, Macro, or VBS Galsaba Excel Discussion (Misc queries) 5 January 14th 05 12:26 AM
how to alter the date within a macro LWhite Excel Discussion (Misc queries) 2 January 4th 05 01:54 PM
Need help troubleshooting an array formula XLXP on Win2K KR Excel Worksheet Functions 1 December 13th 04 07:41 PM
Date and Time Macro m.j.anderson Excel Discussion (Misc queries) 1 December 1st 04 12:35 AM


All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"