I'm having some problems figuring out how to do the following:

I have a column which contains a code (mixed letters and numbers).
The next column contains a number relating to the code.
There are some general categories of the code that can be grouped by using the first 4 digits of the code.

I would like to sum these general categories by writing some funtions that say sumIf the left 4 digits are equal to "abc1" or sumIf the left 4 digits are equal to "xyz2", etc.

I was considering using the text function "Left" but it doesn't seem to take a range . any ideas?