Understanding Data Relationships in Excel
Data relationships in Excel allow you to connect tables based on common fields, enabling better data analysis through tools like PivotTables. This feature is especially useful when dealing with large datasets stored across multiple tables.
What Are Data Relationships?
- A data relationship connects two or more tables using a common field (key).
- Similar to relationships in databases, Excel allows linking tables using primary keys and foreign keys.
- Commonly used in Power Pivot and PivotTables.
Why Use Relationships in Excel?
- To avoid redundant data by storing it across multiple tables.
- To analyze data collectively without manually combining datasets.
- To create meaningful reports and insights.
Steps to Create Data Relationships
- Prepare Your Tables
- Each table must have a unique column (key) that links them.
- Tables should be formatted as Excel Tables using Ctrl + T.
- Enable Data Model
- Go to the Data tab and click Relationships.
- Define the Relationship
- Choose the related tables and columns:
- Primary Table: Contains unique values (e.g., Product IDs).
- Related Table: References the primary table’s key.
- Choose the related tables and columns:
- Use the Relationship in a PivotTable
- Create a PivotTable and pull fields from both tables into the report.
Example: Sales and Products Data
Table 1: Products
| Product ID | Product Name | Category |
|---|---|---|
| P001 | Apple | Fruits |
| P002 | Banana | Fruits |
| P003 | Orange | Fruits |
Table 2: Sales
| Sale ID | Product ID | Quantity | Date |
|---|---|---|---|
| S001 | P001 | 10 | 2024-12-01 |
| S002 | P002 | 5 | 2024-12-02 |
| S003 | P003 | 8 | 2024-12-03 |
Creating the Relationship
- Format both tables as Excel Tables (select each table and press Ctrl + T).
- Go to Data > Relationships.
- Click New.
- Set:
- Primary Table: Products.
- Column: Product ID.
- Related Table: Sales.
- Column: Product ID.
Using the Relationship in PivotTables
- Create a PivotTable by selecting Insert > PivotTable.
- Drag fields from both tables:
- From Products Table: Drag Category.
- From Sales Table: Drag Quantity.
- Analyze sales by category without manually merging the tables.
Key Points
- Relationships eliminate the need for VLOOKUP or XLOOKUP to join data.
- Tables must have consistent data in the key columns for relationships to work.
- Relationships are stored in Excel’s Data Model.

Ankit Srivastava is an IT trainer, technology educator, and digital skills mentor with expertise in programming, data analytics, AI, and software development. He has successfully trained thousands of learners, with more than 10,000 student enrollments on Udemy. His practical teaching approach empowers students and professionals to build in-demand technical skills. Colorstech channel where Ankit posts video tutorials has more than 8000 Subscribers.