I didn't see Pete's link but i am sure that Pete will be able to help you on that..

On the other hand, perhaps we can do this with countif, but i need to see how your data look like.

Can you upload a small sample workbook?