If this is doable by formula it is above my head.

Maybe VBA?

https://www.excelforum.com/excel-gen...ml#post4718186