Wow, it works! Many thanks p45cal.

May I know why adding (1) could make the function work?