Something like that would need to be coded, assuming that this is for google sheets, it is highly unlikely that anyone on this forum would be able to assist with that.
I would suggest posting your question on a forum that is dedicated to google sheets. If you do, please provide a link to that post here.