Count How Often Two People Are on the Same Team in Excel
Question details
Count the weeks when two specified people have the same team color without writing a separate COUNTIFS formula for each week.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Two people have team results in separate rows, with weekly results spread across columns.
- Observed behavior
- The desired result is one count of weeks in which both rows contain Red or both contain Blue.
Check which rows contain the two people and whether each weekly result occupies every column or only even-numbered columns. These formulas check text values such as Red and Blue, not cell fill colors.
Count matches in even-numbered weekly columns
Use this formula when team results are stored in even-numbered worksheet columns, such as B, D, and F.
Click an empty cell where you want the count to appear.
Enter =SUMPRODUCT(ISEVEN(COLUMN(Sheet2!A:AA))*(((Sheet2!A3:AA3="Red")*(Sheet2!A4:AA4="Red"))+((Sheet2!A3:AA3="Blue")*(Sheet2!A4:AA4="Blue")))) and press Enter.
In the formula bar, replace Sheet2, rows 3 and 4, and columns A:AA with the sheet and ranges that contain your data. Keep the two row ranges the same size.

Count matches when every column represents a week
Use this version when each column in the selected range contains a weekly team result.
Count same-team weeks in WPS Spreadsheets
Use SUMPRODUCT in WPS Spreadsheets to count matching Red or Blue team entries across weekly columns in one formula.
- 1. Open the workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
- 2. Choose the result cell: Click an empty cell where the same-team count should appear.
- 3. Enter the formula: If every column represents a week, enter =SUMPRODUCT((Sheet2!A3:AA3=Sheet2!A4:AA4)*(((Sheet2!A3:AA3="Red")+(Sheet2!A3:AA3="Blue"))>0)) and press Enter.
- 4. Adjust and save: Edit the sheet name and row ranges in the formula bar to match your data, then select Save.

Frequently Asked Questions
Can the formula count matching cell fill colors?
No. The formulas compare cell text such as Red and Blue. Enter team names in the cells, or use a separate method that reads fill colors.
How do I count another team color?
For the every-column formula, add another test inside the allowed-values expression, such as +(Sheet2!A3:AA3="Green"), before the closing parenthesis followed by >0.
What happens when I add more weekly columns?
Extend both row ranges in the formula bar to include the new columns. If you add weeks regularly, consider reorganizing the data into a table with one row per person and week.
Why are some weeks skipped by the even-column formula?
ISEVEN(COLUMN(...)) includes only even-numbered worksheet columns, such as B and D. If every column represents a week, use the every-column formula instead.




