If I want to do the belows, what can I do?

Sheet 1
A B C
1 Com 1 Aug 100
2 Com 2 Aug 100
3 Com 2 Sept 120
4 Com 2 Oct 111
5 Com 1 Sept 111
6 Com 3 Oct 130
7 Com 4 Aug 130
: :
: :
: :

Sheet 2
A B C D
1 Aug Sept Oct ...........
2 Com 1
3 Com 2
4 Com 3
5 Com 4

If I want to sum up the number in sheet 2 of Com 1 in Aug, Com 2 in Aug, Com
3 in Aug.............. Com 4 in Oct....etc. What formula can i use? Thank a
lots!