I tried your first formula and I'm getting an error in Excel which is too bad because I think this is exactly what I need to solve my problem.

Thanks.