Excel Formula to Check if Two Teams Are in the Same Division
Question details
Determine whether two teams in a match (e.g., the winning and losing teams) belong to the same division using an Excel formula.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Comparing sports team divisions based on match results when teams are categorized into multiple divisions.
- Observed behavior
- The user needs a logical formula that looks up the divisions for both teams in a specific matchup and outputs a definitive Yes or No if they match.
Ensure you have a complete master list of all teams and their respective divisions set up in your spreadsheet to serve as the reference for your lookup formulas.
Use VLOOKUP and IF Functions to Compare Divisions
This is the most efficient and recommended method. It uses a master lookup table to find the division for each team and compares them with an IF statement.
By nesting two VLOOKUP functions inside an IF statement, Excel will search your master team table, extract the division for both Team 1 and Team 2, and compare them. If the divisions are identical, it returns 'Yes'; otherwise, it returns 'No'.
Create a lookup table in your worksheet, for example in columns F and G. List all the Team Names in column F and their corresponding Divisions in column G.
Select the cell where you want the comparison result to appear (e.g., D2). Type the formula: =IF(VLOOKUP(B2,F:G,2,FALSE)=VLOOKUP(C2,F:G,2,FALSE),"Yes","No"). This assumes B2 and C2 contain the names of the two competing teams.
Press Enter to see the result for the first match. Click the cell, grab the fill handle (the small square at the bottom-right corner), and drag it down to apply the formula to the rest of the matches in your column.

Use COUNTIF to Check Separate Division Lists
This alternative method is helpful if your divisions are separated into individual column lists rather than a single master table.
Use WPS Spreadsheet for Advanced Team Data Analysis
WPS Spreadsheet makes it incredibly easy to use advanced logical formulas like VLOOKUP, COUNTIF, and IF. It helps you manage complex sports schedules, data tables, and dynamic comparisons smoothly.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the match data and team division reference table.
- 2. Input the comparison formula: Select the empty cell next to your match data, and type =IF(VLOOKUP(B2,F:G,2,FALSE)=VLOOKUP(C2,F:G,2,FALSE),"Yes","No").
- 3. Execute the formula: Press Enter to instantly evaluate whether the winning and losing teams are from the same division.
- 4. Batch process the games: Double-click the fill handle at the bottom right corner of the selected cell to automatically fill the formula down to the bottom of your data set.

Frequently Asked Questions
What happens if a team name is misspelled in the match list?
If a team name in your match list does not exactly match the name in your lookup table, VLOOKUP will return an #N/A error. To prevent this, ensure spelling is consistent, or use Data Validation to create drop-down lists for team selection.
Can I use XLOOKUP instead of VLOOKUP to compare teams?
Yes. If your spreadsheet software supports XLOOKUP, you can use the formula =IF(XLOOKUP(B2,F:F,G:G)=XLOOKUP(C2,F:F,G:G),"Yes","No"). XLOOKUP is generally more robust and doesn't require column index numbers.
Are VLOOKUP and COUNTIF case-sensitive?
No, standard VLOOKUP and COUNTIF functions are not case-sensitive. 'Team Alpha' and 'TEAM ALPHA' will be treated identically by the formulas.
How can I automatically highlight games where teams are in the same division?
You can use Conditional Formatting. Select your entire match data range, navigate to Conditional Formatting > New Rule, choose to use a formula, and enter =$D2="Yes" (assuming column D holds your formula results). Choose a fill color and apply.




