Google-sheets – Automatically create an array of unique names and their number of wins

google sheets

I'm trying to make a sheet that I can use to track which heroes I need to practice in a game…
Want to manually input the following things:

Map name (A2:A), Hero name (B2:B), Result (C2:C)

I use D2 To make a unique list of heroes I've played.
=UNIQUE(B2:B)

But then I want to add a corresponding collumn of wins. But I have to manually copy the function below to each row in the D2 and below… Anything to work around that?

=COUNTIFS(B:B;E2;C:C;"Victory")

Best Answer

Short answer

To create an array report, AKA crosstab report, use a Pivot Report.

Instructions

  1. Prepare the data as a simple table.
  2. Select the data
  3. Click Data > Pivot Table...
  4. Add the Name field to the Row section
  5. Add the Result field to the Column section
  6. Add the Name field to the values section. In Summarize by select COUNTA

Example

Assume the following as the data.

+----+--------------+---------+
|    |      A       |    B    |
+----+--------------+---------+
|  1 | Name         | Result  |
|  2 | Batman       | Victory |
|  3 | Superman     | Victory |
|  4 | Batman       | Loss    |
|  5 | Lex Luthor   | Victory |
|  6 | Superman     | Victory |
|  7 | Batman       | Loss    |
|  8 | Lex Luthor   | Victory |
|  9 | Superman     | Victory |
| 10 | Batman       | Loss    |
| 11 | Wonder Woman | Loss    |
+----+--------------+---------+

Result

+---+--------------+------+---------+-------------+
|   |      A       |  B   |    C    |      D      |
+---+--------------+------+---------+-------------+
| 1 |              | Loss | Victory | Grand Total |
| 2 | Batman       | 3    | 1       | 4           |
| 3 | Lex Luthor   |      | 2       | 2           |
| 4 | Superman     |      | 3       | 3           |
| 5 | Wonder Woman | 1    |         | 1           |
| 6 | Grand Total  | 4    | 6       | 10          |
+---+--------------+------+---------+-------------+