You probably don't need a macro to do this. Your data is organized so that a pivot table should be able to do what you want.