This is homework, isn't it?

One of the solutions is a pivot table, feel free to research the topic either in this very same forum or the net.