user11579806
user11579806

Reputation:

How to count how many times each value appear

If I have an line like:

15, 15, 9, 10

How can I count how many times each value appeared? In this example, it would be like:

15: 2, 9: 1, 10: 1

or

15: 50%, 9: 25%, 10: 25%

I don't know if it can help, but my intended use case is to check the most common openings in a chess game, and the distribution. For that, I have an set with 20041 games, each one with an value like D10, B00, C20, C50...

Upvotes: 1

Views: 133

Answers (1)

You can do it easily with COUNTIF (use it to count specific value) and COUNTA(to count all non empty)

enter image description here

COUNTA Function

COUNTIF

The formula I've used in A2 is:

=COUNTIF($A$1:$D$1;A1)/COUNTA($A$1:$D$1)

And then applied % format.

In case you want only to count how many times each value appear, just do:

=COUNTIF($A$1:$D$1;A1)

And normal format.

enter image description here

Hope this helps

Upvotes: 1

Related Questions