This has been posted to the formulas section.
A formula cant do this, VBA is the only solution.