Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

If you keep copying lookup formulas down a column to bring customer or product details into a transaction table, Excel’s Data Model offers another approach: relate the tables once, then use their fields together in a PivotTable or report. The model lives in the workbook; it is not a separate database server. It can reduce duplicated lookup results, but it does not make formulas obsolete or fix mismatched source data automatically.

What Excel’s “hidden relational database” actually is

The Excel Data Model is a collection of related tables stored in a workbook. You can connect tables through matching key columns and analyze fields from those tables together. Power Pivot is Excel’s modeling interface for managing relationships and writing DAX formulas.

Microsoft describes relationships as an alternative to lookup formulas: “Unlike lookup formulas, relationships do not duplicate data. Instead, they link tables so that fields from each table can be used together in a PivotTable.” Microsoft Support explains how to create a relationship between tables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

That distinction matters for maintenance. A formula-based workflow writes a repeated result into rows of a destination table. A relationship-based workflow keeps the source tables separate and tells Excel how their records match. When the source detail changes, refresh or update the model and report rather than maintaining a copied result in every transaction row.

#1 Best Overall
Sale
The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
  • The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
  • ABIS BOOK

When a relationship can replace a lookup formula

Use a relationship when your goal is to analyze or report on data from multiple tables, especially in a PivotTable. For example, keep order lines in an Orders table and customer names or regions in a Customers table. Relate them by customer ID, then add fields from either table to the PivotTable.

Instead of adding a customer name to every order with a lookup formula, you can place Customers[CustomerName] alongside order measures or fields in the report. Microsoft’s documentation on relationships between tables in a Data Model describes how keys connect tables for analysis.

This does not mean every lookup should be removed. A worksheet formula can still be the clearer choice for a small, one-off result that must appear directly in a cell or be exported as a flat table. The Data Model is most useful when the tables should remain distinct and the reporting needs to draw on both.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare the tables and create the relationship

For a dependable model, make the source data structured Excel tables, with a header row and one field per column. The relationship requires a matching key: in this example, each customer ID occurs once in Customers[CustomerID] and may occur many times in Orders[CustomerID].

  1. Load both tables into the Data Model. Use Excel’s Data tab and Get Data workflow to import or connect to the data. In the import/load options, choose to add the data to the Data Model. Microsoft’s Create a Data Model in Excel guide covers loading data and table prerequisites.
  2. Open the relationship tools. Depending on the Excel edition and interface, use Data > Relationships, or open the Power Pivot window and choose its diagram or relationship view. The exact commands can vary by version.
  3. Connect the matching columns. Create a relationship from Customers[CustomerID] to Orders[CustomerID]. Confirm that the customer-side column contains unique values and that both columns use compatible data types.
  4. Create a PivotTable from the Data Model. Choose the workbook Data Model as the source, then add fields from both tables. For example, place customer region in rows and an order amount measure or field in values.
  5. Check the result against known records. Verify that expected customers and totals appear. A relationship suggestion made by Excel is not a substitute for confirming that the selected columns are the intended keys.

Excel’s Data Model creation documentation lists Microsoft 365, Excel 2024, and Excel 2021. Microsoft’s Power Pivot overview also covers Excel 2019 and Excel 2016, but tools and availability differ by edition. Check the documentation for your installed version rather than assuming every Excel interface exposes the same commands: Power Pivot overview and learning.

Choose a relationship or a DAX lookup based on the result you need

A relationship defines how tables connect; it does not itself write a value into every row. If you need an explicit result inside a Data Model calculation, choose the DAX function that matches the intended result.

Need Use What it returns
Use fields from related tables in a PivotTable or report A relationship Related table fields can be used together without copying lookup results into a flattened table.
Return one value from a related table for the current row RELATED A single value reached through an existing relationship, commonly in a calculated column.
Get the rows related to the current row RELATEDTABLE A table of matching rows, which can be used as part of an aggregation pattern.
Find a value using specified search criteria LOOKUPVALUE A value matching the criteria when the desired search is not simply a traversal of an existing relationship.

DAX is aware of the model’s tables, relationships, filters, and evaluation context. A calculated column evaluates for each row and stores a result in the model; a measure calculates in response to the current report context. Be explicit about which you are creating. Microsoft discusses lookup functions in Power Pivot formulas and creating formulas for calculations in Power Pivot. For Excel’s DAX alternatives to VLOOKUP, see VLOOKUP functionality in Power Pivot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check the model’s limits before changing your workflow

  • The lookup-side key must be unique. If the supposed customer or product key has duplicates, it cannot serve as the unique side of a standard one-to-many relationship.
  • Key columns need compatible data types. A number stored as text in one table and as a numeric value in another can prevent a valid match.
  • Composite keys are not supported directly. If a row is identified by multiple fields, combine those components into a single key column before relating the tables.
  • Many-to-many cases need additional modeling. The documented Excel Data Model does not provide a native many-to-many relationship; Microsoft describes using DAX to model such cases.
  • Relationship loops and self-joins have restrictions. A model cannot be treated as an unrestricted network of arbitrary joins.
  • Automatic detection can be wrong. Excel infers potential relationships from column metadata and statistical information about values. Inspect the proposed key pair and verify uniqueness and matching behavior before using it.

These constraints are described in Microsoft’s Data Model relationship guidance. If a relationship fails or results look incomplete, first check key uniqueness, data types, blanks, and whether the source tables actually contain corresponding IDs.

Use Power Query for shaping, then the Data Model for analysis

Get Data and Power Query are useful for importing and cleaning source data; the Data Model is where you relate tables for analysis. These jobs complement each other. For example, use Power Query to standardize customer IDs or remove unwanted rows, load the cleaned tables, then define relationships and build a PivotTable.

Power Pivot supplies the model-oriented interface and DAX tools, but availability and exact UI labels depend on the Excel edition. Microsoft’s Power Pivot overview describes the workflow and supported Excel versions.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.