Hi

I have amended the code. UDFs are slow as compared to in-built functions.