I think it is a data type mismatch problem. You have dimensioned UDF as a double, which contains one value. The Frequency function returns an array (2 or more values). VBA does not know how to assign an array to a double. The Linest function also returns an array, but the sum function returns a double, which is why the sum function works, but the other two do not.
When I have done this (with the linest function, not the frequency function, though it should work the same), I will dimension a temporary variable as a variant (which can hold an array) and assign the result of the frequency function to this temporary variant. Then I can decide which element (or elements) I want assigned to the function for returning to the spreadsheet/calling routine.
Bookmarks