Sorry I haven't got XL here, but wouldn't a Pivot Table be what you need?
Cheers