# Is there a way to count how many entries in a given column have a particular value?

I have a spreadsheet which keeps track of duels between two players in a game. Each row has the number of the match and the winner, given by their initial, X or Y. I want to know if it's possible to get a percentage for how many of the total matches have been won by player X or Y, and maybe make some sort of pie chart.

If that IS possible, then I'd also like to know if it's possible to group results by date. Imagine if there was a third column with the date of each match, would it be possible to create a pie chart for each month? October, November, etc.

Use COUNTIF, e.g. to get a percentage for how many of the total matches have been won by player X: =(COUNTIF(A2:A10,"=X")/COUNTA(A2:A10)*100.

For the grouping, I think you need to use QUERY (GROUP BY).

• Could you elaborate on the QUERY? – Vidar S. Ramdal Nov 11 '13 at 9:27
• E.g. =query(J:L,"select count(K) group by L, J", 0) where J is the winner name, K the date, L = MONTH(K). – Franck Dernoncourt Nov 11 '13 at 20:14

As often, I suggest a pivot table. For the months and pie charts however I would recommend in addition a column to indicate the month, say just the number with something like:

=month(D2)


in E2 copied down to suit. The pie charts can be plotted by selecting such as shown in the image for February. Percentages won by player can be derived from the Grand Total row (5/9 and 4/9 in the example).