I could use some help converting a formula into a UDF. In order to convert the current conventional date into the julian date, I've been using the following:

=TRUNC(+A1-(DATE(YEAR(A1),1,1)-1))

where A1 is the current date. For example today, 8/19/2011, returns the value 231. my question is, how do I convert this into a UDF which I can use in any spreadsheet.

I appreciate your help.