View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Craig[_17_] Craig[_17_] is offline
external usenet poster
 
Posts: 4
Default Convert function to sub

I know this may sound odd, but I was wondering if there
was a user defined function equivalent to the following
array formula:

={AVERAGE(IF((DateRange=A1)*
(DateRange<=A2),StockPrice,FALSE))}

What this does is look up the dates in 'DateRange' that
fall between the dates entered into cells 'A1' and 'A2',
and then takes the average of the prices from the
range 'StockPrice'.

Thanks for any help.