Excel formula help needed: COUNTIF x Grade Weighting

Hello, I'm using COUNTIF to find the number of each grade for GCSE results but I want it to recognise that some or worth more or less than one GCSE. I was thinking of having a row with the 'GCSE Weighting' in it, i.e. 0.5, 1, 2 etc. but I can't think how to incorporate this into the fomula. I want it to look at the correct cell in the 'GCSE Weighting' row for that result, i.e. Count how many A's there and times it by the correct weighting for each occurance.

In previous years I've just grouped different weightings together and used seperate formulas for each group, but I'm trying to cut down the size of the spread sheet (and feel a bit clever).

Any ideas?