View Single Post
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

=SUMPRODUCT(--(Bookings!D3:D7=--"2005-01-01"),--(Bookings!D3:D7<=--"2005-01
-31"),Bookings!H3:H7)

No VBA!

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Joe Blow" wrote in message
...

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