If I understand what you are asking, I suggest using the sumif function. To sum all the "b" in column A it would look like this: =SUMIF(A4:A200,"b",B4:B200)

You can use the same function to find the sum of K: =SUMIF(G4:G200,"b",K4:K200).

If you want to nest the functions, it would look like this: =(SUMIF(A4:A200,"b",B4:B200))-(SUMIF(G4:G200,"b",K4:K200))

Lastly, you can replace the b with a cell reference. If you are going to list the B, C, M, Y in separete cells to indicate which item you are calculating, then change the "b" to refer to the cell (eg N9).

Looking at the formula you have in your spreadsheet, I'm not sure what you want to do with the "colors". As always you can use F4 or $ to lock the cell reference in the range.