You will have to use a macro.
Excel 2021 and 365 have a built-in Function
I'll lookup my VBA code and post it when I find it