How to Count Players Who Appeared Together in Excel
Question details
The user needs to count the number of times two specific players appear together within the same group, game, or team in a dataset.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Tracking player co-occurrences or pair frequencies when groups are arranged across multiple columns and rows.
- Observed behavior
- Using a standard COUNTIFS formula fails to accurately count two different names within the same group because the data is spread across multiple columns, making simple row-by-row criteria matching ineffective.
Ensure your dataset clearly separates different games or teams into distinct rows or assigns a unique ID to each group before you begin applying formulas.
Restructure Data and Use COUNTIFS or a PivotTable
The most robust method for analyzing co-occurrences is to normalize your data so each player has their own row associated with a specific Game ID or Group ID.
When player data is spread across horizontal columns, traditional formulas struggle to evaluate all combinations. Normalizing the data turns it into a structured list that Excel handles natively.
Add a unique identifier column, such as 'Game ID' or 'Group ID', to distinguish each specific grouping.
Restructure your layout so that each row contains the Game ID and only one player name. You can utilize the Power Query 'Unpivot Columns' feature to achieve this quickly if your original data spans horizontally.
Once your data is in two columns (Game ID and Player Name), use a PivotTable or a standard COUNTIFS formula referencing the Game ID to identify and count instances where both Player A and Player B share the exact same ID.

Use a Helper Column with Logical Formulas
If you cannot change the current layout of your spreadsheet, you can insert a helper column to test each row for the presence of both players.
Count Co-occurrences Easily with WPS Spreadsheet
WPS Spreadsheet provides powerful logical functions, helper column support, and intuitive data restructuring tools, allowing you to seamlessly track and count player co-occurrences without complex workarounds.
- 1. Open Your Dataset: Launch WPS Spreadsheet and open the file containing your player groupings.
- 2. Add a Helper Column: Insert a new column next to your existing rows of data to act as your verification column.
- 3. Input the Formula: Type the formula =AND(COUNTIF(range, "Name1")>0, COUNTIF(range, "Name2")>0) into the first cell of the helper column and drag it down.
- 4. Count the True Values: Use a simple =COUNTIF() formula targeting your helper column to sum up all the TRUE instances, revealing your co-occurrence total.

Frequently Asked Questions
Can I count more than two players appearing together in the same group?
Yes. If you are using the helper column method, you can expand the logic inside the AND statement. Simply add a third or fourth COUNTIF condition, such as COUNTIF(A2:D2, "Player3")>0, separated by a comma.
Why doesn't a standard COUNTIFS formula work on multi-column groups?
The COUNTIFS function evaluates criteria in parallel ranges. If player names can appear in any order across multiple columns, COUNTIFS cannot reliably map 'Player A' and 'Player B' because they might swap column positions from row to row.
Is there a way to count pairs without adding a helper column?
Yes, advanced users can utilize array formulas involving functions like SUMPRODUCT or MMULT to evaluate multi-column matrices directly. However, these formulas can be highly complex to write and maintain compared to using a simple helper column.




