Thanks for the answers.
Pike - I've entered the formula as shown and it comes up "#N/A".
I'm not sure whether I've exlained the problem correctly or entered the fomula correctly, so I've attached a sample file which will demonstrate what I would like to achieve.
Bookmarks