Number format in User Defined Functions
I'm writing a basic UDF that will calculate a compound annual growth rate. As part of the function, I want the answer to be expressed as a percentage, and not a decimal.
I believe the code I want to do this is: NumberFormat = "0.00%"
However, I have been unable to apply this code to the UDF.
If it helps, the relevant part of the code where this would fit in is:
Function CAGR(StartValue, EndValue, NumberOfYears)
CAGR = (((EndValue / StartValue) ^ (1 / NumberOfYears)) - 1)
End Function
Any thoughts on how to incorporate in the number formating would be greatly appreciated.
Cheers!
|