Zend certified PHP/Magento developer

Microsoft excel – create 2D table from list of pairs

I’d like to ask for help with following excel issue: I am interpreting results of a questionnaire so I have a pair of values. First column contains a category, let’s say A,B,C, while the second has a rating 1-3. So I have data like this:

Category Rating
A 2
A 1
B 2
C 3

you get the drift.

I’d like to count how many people for each category gave specific rating.

in this case, the expected solution would be like this:

X rating 1 rating 2 rating 3
A 1 1 0
B 0 1 0
C 0 0 1

I tried going with COUNTIF, but I cannot seem to get the condition quite right.
I’d rather avoid using auxiliary cells, but if it cannot be helped, I am able to use them.