Easy answer is to have columns counting the Rs, As and Gs on each row and then use sumifs on that column
If you don’t like adding columns (i don’t)…
If youve not got that many products you could do Countifs(b:b,“july”,c:c,“spend”,d:d,“r”)+ same but change d:d to e:e and so on
Are you using google sheets or excel? If google sheets, you can use filter() to only look at july and spend and then count the Rs
If excel I’m a little rusty but I’m sure it’s doable