View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Arrays in User defined functions

Try

Evaluate("SUMPRODUCT(--(DATA!B1:B100=""AM""),--(DATA!E1:E100=" & Month(Date)
& "))")

--

HTH

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


"Naomi" wrote in message
...
Hi,
I have the following in a function that is essentially the conditional

sum,
counting the number of occasions when one column has the value AM in it

and
the other has the date Curr_month. Is there any way of doing this so that

it
runs faster? Can array functions be used in VB?

dim AM as string
dim Curr_month as date
dim meets, count_meetings as integer

If Sheets("DATA").Cells(i, 2).Value = AM And Sheets("DATA").Cells(i,
5).Value = Curr_month Then
meets = meets + 1
Else
End If


i = i + 1
Loop
Count_meetings = meets