Do User-Defined-Functions accept arrays as arguments?
I am trying to create a simple formula to count the number of dates in a named array that fall within a specified month. I created a User Defined Function to help simplify the formula. The UDF is:
Function FOMONTH(inputdate) As Date ‘First of Month
FOMONTH = DateSerial(Year(inputdate), Month(inputdate), 1)
End Function
The UDF appears to work when its argument is a single value, but NOT when its argument is a named array. In contrast, Excel built-in functions work either way.
For example, this formula works and returns the correct value:
{=COUNT(IF(( DATE(YEAR(SaleDate),MONTH(SaleDate),1)=FOMONTH($A20)),SaleDate,FALSE))}
However, this formula does NOT work, even though the only difference is that I have used my UDF instead of Excel built-in functions:
{=COUNT(IF(( FOMONTH(SaleDate)=FOMONTH($A20) ),SaleDate,FALSE))}
Is there any way to make a UDF accept an array as an argument, just like the Excel built-in functions ? or am I doing something wrong?
Thanks for any response
Bookmarks