Pivot Table Issues

How to Create a PivotTable for Many-to-Many Excel Data

Natalie TaylorNatalie Taylor Nov 10, 2026 869 views

Question details

The user needs to build a PivotTable that combines earnings and expenses data from multiple tables that contain repeated establishment names, without creating a direct many-to-many relationship.

How to Create a PivotTable for Many-to-Many Excel Data
Product
Microsoft Excel
Device & OS
not provided
Scenario
Analyzing earnings and expenses across multiple locations where both the income and expense tables contain duplicate establishment names.
Observed behavior
Attempting to link the two tables directly fails or produces inaccurate aggregations because standard PivotTables and Data Models require a one-to-many relationship to function correctly.
Before you start

Ensure both your earnings and expenses datasets are formatted as official Excel Tables and verify that there are no blank rows interrupting your data.

Solution 1Recommended

Use a Lookup Table and Power Pivot Data Model

This is the most robust method for handling many-to-many relationships. By creating a unique 'bridge' table, you can establish two valid one-to-many relationships within the Data Model.

A direct many-to-many relationship prevents Excel from knowing how to properly aggregate the amounts. Creating a lookup table containing a single instance of each establishment name resolves this ambiguity.

1
Create a Unique Lookup Table

Copy all establishment names from both the earnings and expenses tables into a single new column on a new worksheet. Navigate to Data > Remove Duplicates to leave only a list of unique names. Format this list as a Table.

2
Add Tables to the Data Model

Click inside your Earnings table, go to the Power Pivot tab, and select 'Add to Data Model'. Repeat this step for your Expenses table and your new Lookup table.

3
Create Relationships

In the Power Pivot window, click on 'Diagram View'. Drag the establishment name field from the Lookup table and drop it onto the establishment name field in the Earnings table. Repeat the process to connect the Lookup table to the Expenses table.

4
Build the PivotTable

From the Power Pivot window, click 'PivotTable' to insert it into a new worksheet. In the PivotTable Fields pane, place your Dates in the Rows area, your Earnings and Expenses amounts in the Values area, and use the establishment field from your Lookup table for the Filters or Columns area.

Best Practice: Always pull filtering and grouping fields (like dates or establishment names) from your unique lookup tables, never from the data (fact) tables.

Effortlessly Create and Manage Pivot Tables in WPS Office

WPS Spreadsheet offers powerful data analysis capabilities, including intuitive PivotTables, seamless formula support, and the ability to consolidate multiple tables to handle complex data relationships with ease.

  1. 1. Open Your Data: Launch WPS Spreadsheet and open your workbook containing the earnings and expenses tables.
  2. 2. Consolidate Your Data: Use built-in functions like VLOOKUP or Data Consolidation tools to merge your establishment data into a single master sheet.
  3. 3. Insert PivotTable: Navigate to the 'Insert' tab on the top ribbon and select 'PivotTable'.
  4. 4. Design Your Report: Select your consolidated data range and drag the establishment names, dates, and amounts into the appropriate Rows, Columns, and Values fields to generate your summary.
100% compatible with Microsoft Excel file formats (.xlsx, .xls, .csv).Intuitive PivotTable interface for quick data summarization and reporting.Built-in dynamic array functions for advanced data filtering and reshaping.Lightweight, fast, and completely free alternative for your daily office tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why can't I create a direct many-to-many relationship in a standard Excel PivotTable?

Standard PivotTables and traditional Data Models require at least one side of a relationship to have strictly unique values (a one-to-many relationship). Without this, the PivotTable cannot accurately determine how to group and sum duplicate records across tables, leading to calculation errors.

What is a lookup table in Excel data modeling?

A lookup table (also known as a dimension table) is a table that contains a single, unique row for each item. In this scenario, it acts as a central bridge containing unique establishment names, connecting the separate earnings and expenses tables.

Can I use VLOOKUP or XLOOKUP instead of a Data Model?

Yes. If your dataset isn't exceptionally large, you can use VLOOKUP or XLOOKUP to pull categories from a lookup table directly into your earnings and expenses tables, or merge them into a single master table before inserting a standard PivotTable.

Is Power Pivot available in all versions of Excel?

Power Pivot is included in most modern Windows versions of Excel (such as Excel 2016, 2019, 2021, and Microsoft 365) but may need to be enabled via the COM Add-ins menu. It is currently not supported on Excel for Mac.