You create a many-to-many relationship in an Excel Data Model by inserting a junction table (also called a bridge or linking table) between the two tables, then building two one-to-many relationships through it. Excel's Data Model cannot join two tables directly when both sides have duplicate keys, so the junction table holds one row per unique key combination and lets the Power Pivot engine filter in both directions. The practical payoff: a pivot table that combines, say, students and courses, or products and suppliers, without duplicating rows or flattish VLOOKUP columns.

What You'll Need

  • Excel for Windows or Mac (Microsoft 365 or Excel 2019 and later) with Power Pivot available on the Data tab. The stock Data Model in Excel for the web is more limited, so do this on desktop.
  • Two source tables with a column that identifies each record uniquely (an ID or key column), and a column in each that links to the other side.
  • Clean data: no blank key cells, consistent data types, and no merged cells in the header rows.
  • The two tables loaded into the Data Model as separate tables, each added from its own worksheet range or query.

Step-by-Step

  1. Name your tables. Select each source range and use Insert > Table (Ctrl+T or Cmd+T). Give each a meaningful name on the Table Design tab, for example Products and Suppliers. Labels can differ slightly by version, but this tab is consistent.
  2. Build the link table. Create a third range in a new sheet with one row per pairing. For products and suppliers, columns would be ProductID and SupplierID, and if a product has three suppliers it gets three rows. Add any attributes that belong to the pairing itself, such as UnitCost or LeadTime. Convert it to a table and name it ProductSupplier.
  3. Verify the unique keys. In the Products table, every ProductID must appear once. Same for SupplierID in Suppliers. If you have duplicates, the relationship will fail with an error about duplicate values. Use a quick pivot count or Remove Duplicates to check before continuing.
  4. Load all three tables to the Data Model. Select each table, then go to Data > Manage Data Model or use Power Pivot > Add to Data Model. In current Excel, Power Pivot > Add to Data Model is the reliable path for each table. Do not also add them as ordinary pivot caches, or you will end up with duplicate table names.
  5. Open the diagram view. In the Power Pivot window, choose Home > Diagram View. You should see three table boxes. Drag them apart so the lines are readable.
  6. Create the first relationship. Drag the ProductID field from Products onto the ProductID field in ProductSupplier. Excel should draw an arrow pointing from the one side to the many side. If the arrow points the wrong way or Excel asks you to pick, use Design > Create Relationship and set the fields and cardinality manually.
  7. Create the second relationship. Drag SupplierID from Suppliers onto SupplierID in ProductSupplier. You now have a chain: Suppliers one-to-many to ProductSupplier, and ProductSupplier many-to-one back to Products. That chain is the many-to-many.
  8. Confirm cardinality. Double-click each relationship line. Each should read one-to-many with the unique-key table on the one side. If either says many-to-many, your key column has duplicates, or you picked the wrong field.
  9. Understand the filter direction. The arrows flow from the lookup tables into the junction table. That means a pivot can filter Products by Supplier, because the supplier filters flow into ProductSupplier and then out to Products. This is the reason the pattern works at all.
  10. Build the pivot. Back in Excel, Insert > PivotTable, choose Add this data to the Data Model. In the field list, put a field from Products in Rows, a field from Suppliers in Rows or Filters, and a numeric measure such as a count or a sum from ProductSupplier in Values. Because the filter path runs through the junction table, the result is correct.
  11. Test with a known case. Pick a product that has two suppliers and confirm it appears twice with the right split, then check a product with one supplier. If the numbers look doubled, you probably joined on the wrong column or dragged fields in a way that created a second path.
  12. Retire the junction table from the pivot layout. Do not put its key columns in Rows unless you want the raw pairings. Use it for measures and as the bridge, and keep the display fields coming from the two outer tables.

Common Mistakes

The most frequent failure is putting non-unique values on the one side. A relationship in the Data Model needs a column with no duplicates on the one side, so a lookup on a text name that repeats will break it. Use a stable ID instead of a name.

Second is adding the same worksheet as both an ordinary pivot cache and a Data Model table. You then get a table called Products and another called Products1, and relationships attach to whichever you drag from, which produces empty or doubled results.

Third is assuming the arrows run both ways. They do not by default. If you need the outer tables to filter each other in both directions, you can set cross-filter direction on a relationship, but be aware that many-to-many filter propagation can produce ambiguous or inflated totals. Test before relying on it.

Fourth is mismatched data types. An ID stored as text in one table and as a number in another looks identical on screen but will not join. Convert both to the same type, and trim stray spaces with the TRIM function before loading.

Fifth is treating the junction table as optional cleanup. Without it, Excel refuses or produces a many-to-many relationship that it warns you about. The bridge table is the solution, not a workaround.

Tips

Name your keys consistently, something like ProductID in every table, so the diagram and field list stay readable. Keep the junction table narrow: two keys plus the attributes that genuinely belong to the pairing. Anything else belongs in one of the outer tables.

Add a unique row identifier to the junction table if you plan to count rows, because duplicated pairings are easy to introduce when importing. A distinct count measure on the key gives you a truer figure than a row count.

Refresh both the queries and the Data Model after editing source data, since the pivot does not see worksheet changes until you refresh. If you build the tables with Power Query, filter out blank keys before loading so those rows never reach the relationship.

Troubleshooting

Excel says the relationship needs unique values. Find and remove duplicates on the one side, or use the junction key that is genuinely unique. Duplicates often come from trailing spaces, so clean the column first.

The diagram shows a many-to-many line. Delete that relationship and rebuild it after fixing keys, or open Create Relationship and set both fields explicitly with one-to-many cardinality.

The pivot returns blank cells. Check that the filter is on the side the arrow leaves. If you are filtering the Products table by a Supplier field and totals are empty, the arrow direction is wrong or the relationship points at the wrong table.

Totals look doubled. A measure is probably summing the junction table plus an outer table, or two filter paths exist. Use a single measure from one table and confirm only one path connects the fields in your pivot.

The pivot only shows fields from one table. The table was added as an ordinary range rather than to the Data Model. Remove it from the pivot cache and reload via Power Pivot > Add to Data Model.

If that did not work, delete all three tables from the Data Model, save and reopen the workbook, and rebuild the relationships one at a time, checking each with a single-field pivot before adding the next.

Frequently Asked Questions

Can Excel handle a direct many-to-many relationship?

Not reliably. The engine expects one side with unique keys. The junction table turns the problem into two clean one-to-many relationships, which is the supported pattern.

Does the junction table need its own ID column?

No, but it helps. Two key columns are enough for the relationships; an extra distinct row ID makes row counting unambiguous.

Why do my products disappear from the pivot after adding a supplier filter?

Products with no matching row in the junction table have no supplier, so they are filtered out. Either add their default supplier to the bridge table or accept the inner-join behaviour.

Can I edit source data after building the model?

Yes, but you must refresh. For worksheet tables, right-click the pivot and choose Refresh; for Power Query tables, use Refresh All on the Data tab.

Can I make the filters work both ways?

You can set the cross-filter direction on a relationship, but bidirectional filtering across a bridge can inflate totals. Keep it one-way unless you have tested the result.