macak, can be done, but I would recommend VBA for this rather than formula.