Excel pivot tables let you transform raw data into clear insights, but when combining two separate tables into one, you gain deeper analysis. This method efficiently links tables by their common fields, so you can pivot across both datasets at once. You’ll need two structured Data Tables in Excel, and the pivot table will automatically reference both if they share matching keys—no manual merging required. The result is a single pivot that aggregates data from multiple sources without copying rows.
What You'll Need
- Two Excel Data Tables (either in separate sheets or as dynamic ranges with headers)
- Common column(s) between the tables (e.g., "Product ID" or "Customer Name") to link them
- Excel 2013 or later (PivotTables work similarly in older versions but lack advanced linking)
- A blank pivot table range (e.g., B1:D100) where you’ll create the result
- Optional: Power Query (for advanced transformations if tables aren’t already clean)
Step-by-Step
- Prepare Your Tables
- Ensure both tables have identical headers in the first row (e.g., "ID, Name, Value"). Name sheets if they’re separate or use a helper column to reference them (e.g., if Table1 is A1:D100, "Table1" in A1, then A2:D100).
- If data is in separate sheets, copy and paste as values (Ctrl+Shift+C > Ctrl+V) to avoid formatting conflicts in the pivot table.
- For dynamic ranges, use formulas like `=Table1$A$2:$D` (where `$` locks row/column references) and update manually if the source changes.
- Create a Linked PivotTable
- Go to the **Insert** tab > **PivotTable** (button). Select "New Worksheet" and choose a location (e.g., B1:D100).
- In the **PivotTable Fields** pane (right side), click the dropdown arrow next to a field (e.g., "ID"). Hold **Ctrl** and click the same field in the second table (if separate sheets). This adds both as options in the pivot.
- Alternative for separate sheets:** Right-click the sheet tab > **View Source**, paste a reference like `=Sheet2!A2:D100` for the second table into the pivot table’s data range. Replace `Sheet2` with the sheet name.
- Filter by the Common Key
- Drag the shared column (e.g., "ID") into the **Rows** area of the PivotTable Fields pane. Now the pivot shows grouped data from both tables.
- To see values only from one table, right-click the field > **Filters** > **Show Items in List** or **Show Items Not in List**.
- Pivot the Values
- Drag any numeric column (e.g., "Value") into the **Values** area. Excel will sum/count/average across both tables based on the filtered key.
- For custom aggregations (e.g., max), right-click the field > **Field Settings** > **Summarize Values By: Maximum**.
- Refine with Slicers (Optional)
- Insert a **Slicer** (Insert > Slicer) for the shared key to filter dynamically across the entire pivot table.
- Drag the slicer into the pivot table’s field list to see live updates.
Common Mistakes
- Copying merged rows instead of linking tables: If rows are duplicated (e.g., "ID=1" appears in both tables), Excel treats them as separate entries. Fix: Remove duplicates first (Data > Remove Duplicates) or use Power Query to merge tables before pivoting.
- Forgetting to include the key field: Without a matching column (e.g., "ID"), the pivot treats data as ungrouped lists. Fix: Drag the key field into the Rows area before adding values.
- Incorrect sheet references: If tables are in separate worksheets, Excel may fail to link properly. Fix: Use the **View Source** method or paste merged ranges into a single sheet beforehand.
- Ignoring header row conflicts: Two tables with identical headers may cause errors. Fix: Explicitly name the first row of each table (e.g., "Table1 Header") before pivoting.
Tips
- Use Power Query for advanced merging: If tables are unstructured or linked by non-header columns, open **Data > Get Data > From Table/Range**, merge the tables in Power Query, then export as a range before pivoting.
- Cache pivot tables for speed: Right-click the pivot table > **PivotTable Options** > **Enable Calculated Fields/Items** if you’ll filter frequently. This speeds up large datasets.
- Label your pivot fields clearly: Rename fields in the PivotTable Fields pane (e.g., "Total Sales" instead of "Sum of Sales") to avoid confusion when switching tables.
- Test with a small sample: Start by pivoting just 5 rows from each table to debug linkage issues before scaling up.
- Leverage Excel’s "Table" feature: Convert both tables to Excel Tables (Ctrl+T) before pivoting—this ensures headers are preserved and easier referencing.
Troubleshooting
- Pivot table shows blank data:
- Double-check that the shared key column is dragged into the Rows area.
- Verify both tables have identical numeric fields for aggregation (e.g., both must sum "Sales" if you drag it into Values).
- Restart Excel and refresh the pivot table (right-click > **Refresh**).
- Error "Cannot find table reference":
- Ensure table names/sheet names are correct (e.g., `Sheet1!A2:D100`).
- If using separate sheets, try copying both tables into one sheet first, then reference the merged range (e.g., `CombinedData!$A$2:$D$50`).
- Update the pivot table range (right-click > **PivotTable Settings**) if the source data expanded.
- Slow performance with large tables:
- Reduce the number of rows in the pivot table range (e.g., limit to 1,000 rows).
- Enable "PivotTable Options" > **PivotCache: Refresh on File Open** to avoid recalculating.
- Convert tables to Excel Tables and uncheck "Allow editing of table values" to speed up updates.
- Data doesn’t aggregate correctly:
- Right-click the aggregated field > **Field Settings** > **Summarize Values By** to ensure you’re using the right calculation (e.g., Sum, Average).
Frequently Asked Questions
Why does my pivot table ignore the second table?
Your tables likely aren’t linked properly. Ensure you either:
- Hold Ctrl while dragging the shared key field into Rows, or
- Use the "View Source" method to reference both tables in the pivot range.
Can I pivot two tables from different worksheets into one?
Yes, but you must merge their data first. Copy both tables into one worksheet, then reference the combined range in the pivot table (e.g., `Sheet1!$A$2:$D$50`).
How do I force a pivot table to use specific columns from both tables?
Drag the shared key into Rows, then drag each table’s unique columns into Values. Excel will show grouped data across both datasets.
What if my tables don’t have matching headers?
You must rename headers (e.g., "CustomerID" in both tables) or use Power Query to merge them. Headers must match exactly for linking.
Is there a way to pivot tables with different data types?
No—instead, preprocess data so numeric columns align (e.g., both tables have "Sales" columns). For mixed data, use conditional formatting or Power Query to cleanse columns.
How do I undo a pivot table created from two sources?
Delete the pivot table range, then recreate it with one clean table. Alternatively, move the pivot table to a new worksheet where it won’t conflict.