Quote Originally Posted by Dave View Post
Can the UDF be extended to ensure that the answer relates to the criteria month. If a person asks for the 5th instance, the UDF should provide the answer only if the 5th is in the specified month otherwise "N/A"

Can the UDF's name and one of the criteria names be the same? I changed a word in "NthDay As Long" and "DateSerial(YearNumber, MonthNumber, 1 + 7 * NthDay) to "NthDayx"
Thank you very much for you comments Dave. I'm not exactly sure what happened with that first argument name (I think a last minute replace operation to "improve" the function name got carried over into the code section), but you are right, you cannot have the function and one of its arguments with the same name. I have changed the code to reflect this... and I also changed it by adding an optional argument, that if set to True, will do what you asked for regarding the #N/A error.