Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Table Relationships: Step-by-Step Guide

· 7 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To create a table relationship in Excel, you need at least two tables (or ranges) with a common column, and you must use the Data Model. The quickest path: select any cell in your first table, go to Data > Relationships, click New, choose the two tables and the matching columns, and click OK. This links the tables so you can analyze them together in a PivotTable without VLOOKUP or manual merging. The steps below walk through the whole process, including how to load tables into the Data Model first, because that is the part most people miss.

What You'll Need

  • Two or more Excel tables (or ranges formatted as tables) that share a common field, such as CustomerID or ProductID.
  • Excel 2013 or later on Windows, or Excel 2016 or later on Mac. The Relationships feature is not available in Excel for the web or older versions.
  • Clean data: each table should have a single header row, no blank rows, and consistent data types in the shared column (for example, both should be text or both numbers).
  • Tables loaded into the Data Model. If you created them with Insert > Table, they are not in the model yet; you will add them in step 1.

Step-by-Step

  1. Format each range as a table. Select a cell in your first data range and press Ctrl+T (Windows) or Command+T (Mac). Confirm the range and that “My table has headers” is checked. Repeat for the second table. Give each table a meaningful name on the Table Design tab (for example, Sales and Products).
  2. Load the tables into the Data Model. Click inside the first table, then go to Data > From Table/Range (in some versions it is under the Get & Transform Data group). In the Power Query Editor that opens, click Close & Load and choose Close & Load To…. In the dialog, select Only Create Connection and check Add this data to the Data Model. Click OK. Repeat for the second table. You now have both tables as connections in the model, not as visible sheets.
  3. Open the Relationships dialog. Go to the Data tab and click Relationships. (On Mac, it may be under Data > Relationships as well.) If you have never created one, the dialog is empty.
  4. Create a new relationship. Click New. In the Create Relationship dialog, set the Table dropdown to your first table (for example, Sales). Set the Column dropdown to the shared field (for example, ProductID). Then set the Related Table to the second table (Products) and the Related Column to the matching field (also ProductID).
  5. Check the cardinality. Excel usually detects whether the relationship is one-to-many or one-to-one. If it shows a warning, make sure the “one” side has unique values in the shared column (no duplicates). For a typical sales-products setup, Products is the “one” side and Sales is the “many” side. If Excel cannot detect it, you may need to set it manually; the option appears only when the data supports it.
  6. Click OK. The relationship is saved. You can add more relationships the same way if you have additional tables.
  7. Build a PivotTable from the Data Model. Go to Insert > PivotTable. In the dialog, choose Use this workbook's Data Model and pick a location. Click OK. In the PivotTable Fields pane, you will see all tables in the model. Drag fields from different tables into Rows, Columns, and Values. Excel uses the relationships to join the data automatically.
  8. Verify the link. Add a field from the second table (for example, ProductName) to the PivotTable and check that it shows the correct values for each row. If it shows blanks or errors, the relationship is likely mismatched or the shared column has data type differences.

Note: Menu labels can differ slightly by Excel version, platform, or region. The steps above are for Excel on Windows; on Mac, the Data tab and dialog names are similar but may be arranged differently.

Common Mistakes

  • Not loading tables into the Data Model. Creating a relationship requires the tables to be in the model. If you only formatted them as tables on a sheet, the Relationships dialog will not list them.
  • Mismatched data types. If one table stores IDs as text and the other as numbers, the relationship may fail or return blanks. Convert both to the same type before creating the link.
  • Duplicates on the “one” side. The table you designate as the “one” side must have unique values in the shared column. If it has duplicates, Excel may refuse to create the relationship or create a many-to-many link that behaves unexpectedly.
  • Using a PivotTable based on a single table. If you insert a PivotTable from a normal table (not the Data Model), it will not see the relationships. Always choose “Use this workbook's Data Model” when inserting the PivotTable.
  • Forgetting to refresh. If you add new rows to the source tables, the Data Model connections may need a refresh (Data > Refresh All) before the PivotTable reflects them.

Tips

  • Name your tables clearly before loading them; the names appear in the PivotTable Fields list and make relationships easier to manage.
  • Use a dedicated ID column (like CustomerID) rather than names, which can have duplicates or inconsistent spelling.
  • You can view and edit existing relationships from Data > Relationships; select one and click Edit or Delete.
  • If you need to relate more than two tables, create a relationship for each pair that shares a common column. Excel supports multiple relationships in one model.
  • For complex models, consider using Power Pivot (available in some Excel versions) for more control, but the basic Relationships feature is enough for most home and small-business data.

Troubleshooting

If the relationship does not work as expected, try these checks in order:

  • The tables do not appear in the Relationships dialog. They are not in the Data Model. Re-load them using Data > From Table/Range and choose “Add this data to the Data Model” as in step 2.
  • Excel says it cannot create the relationship. Check that the shared column has the same data type in both tables and that the “one” side has no duplicates. Also ensure there are no blank cells in the shared column on the “one” side.
  • The PivotTable shows blanks or #N/A for related fields. The relationship may be pointing to the wrong columns, or the values do not match exactly (extra spaces, different case). Clean the data and recreate the relationship.
  • The PivotTable does not update when you add data. Refresh the Data Model: Data > Refresh All. If the source range is not a table, convert it to a table so new rows are included automatically.
  • You need to remove a relationship. Go to Data > Relationships, select the relationship, and click Delete. This does not delete data, only the link.

Frequently Asked Questions

Can I create a relationship between two tables on different sheets?

Yes. The tables can be on different sheets or even in different workbooks (as long as both are open and loaded into the Data Model). The Relationships feature works across the workbook's Data Model.

Do I need Power Pivot to use table relationships?

No. The basic Relationships feature is available in Excel 2013 and later without Power Pivot. Power Pivot offers more advanced modeling, but it is not required for simple relationships.

What is the difference between a relationship and a VLOOKUP?

A relationship links tables in the Data Model so a PivotTable can use fields from both without repeating formulas. VLOOKUP pulls values into a column but does not create a reusable link; you must copy the formula down and maintain it manually.

Can I create a relationship between more than two tables?

Yes. You can create multiple relationships, each linking two tables that share a common column. For example, Sales linked to Products and Sales linked to Customers. The PivotTable can then use fields from all three.

Why does Excel say my relationship is “many-to-many”?

This happens when neither table has unique values in the shared column. Excel may still allow the relationship, but results can be unpredictable. For best results, ensure one table has unique values (the “one” side) and the other can have duplicates (the “many” side).

Does this work in Excel for Mac?

Yes, Excel 2016 and later for Mac support the Data Model and Relationships feature. The menu locations may differ slightly; look under the Data tab for Relationships.