Hard to say for sure without seeing what you are working with, but take a look at a pivot table..