Hi, and welcome to the forum.

If you could post an example spreadsheet it would be much easier for somebody here to work out what is required.