To combine two columns in a pivot table, you don’t merge the source data—instead, you add both fields to the same area (Rows or Columns) to create a multi-level layout, or you create a calculated field to perform arithmetic between them. The exact method depends on whether you want to display the columns side by side, stack them hierarchically, or compute a new value from them.
Understanding What “Two Columns” Means in a Pivot Table
A pivot table summarizes data from a source range or table. When people say “pivot table two columns,” they usually mean one of three scenarios:
- Two fields in the Rows area – e.g., Region and Product, producing a hierarchical row layout.
- Two fields in the Columns area – e.g., Year and Quarter, producing a column grouping.
- Two fields combined into one value – e.g., subtracting Cost from Revenue using a calculated field.
Each scenario has a different purpose and method. The most common request is to show two columns of data (like Sales and Profit) side by side for each row item—this is achieved by adding both fields to the Values area.
How to Add Two Columns to the Values Area
If your source data has columns like Product, Sales, and Profit, and you want a pivot table that shows each product with both Sales and Profit as separate columns, do this:
- Select any cell in your source data and go to Insert > PivotTable (or Insert > Pivot Table on Mac).
- In the PivotTable Fields pane, drag Product to the Rows area.
- Drag Sales to the Values area.
- Drag Profit to the Values area as well.
Excel will place both fields as separate columns in the pivot table, showing a sum for each. By default, they appear as “Sum of Sales” and “Sum of Profit.” You can rename them by clicking the field drop-down in the Values area and choosing Value Field Settings.
If you want the two fields stacked vertically (one below the other) instead of side by side, drag the second field below the first in the Values area—this creates a compact layout with each value on its own row.
Using Two Columns in the Rows Area for Hierarchy
Dragging two fields to the Rows area creates a hierarchical grouping. For example, with Region and Product in Rows, the pivot table shows each region, and under it, each product. This is useful for drill-down reports.
To do this:
- Drag Region to Rows.
- Drag Product below it in Rows.
The order matters—the first field becomes the outer grouping. You can reorder by dragging fields up or down in the Rows area. On a Mac, the same steps apply, but the PivotTable Fields pane may look slightly different; the logic is identical.
Combining Two Columns into a Calculated Field
If you want to create a new value from two existing columns—like profit margin (Profit / Sales)—use a calculated field. This is different from adding both columns to the Values area because it computes a new field on the fly.
Steps:
- Click anywhere in the pivot table.
- Go to PivotTable Analyze > Fields, Items & Sets > Calculated Field (on Mac: PivotTable Analyze > Calculated Field).
- In the dialog, name the field (e.g., “Margin”).
- In the Formula box, type an expression like
=Profit/Sales(using field names exactly as they appear in the source). - Click Add, then OK.
The calculated field appears in the Values area. Note that calculated fields cannot reference other calculated fields, and they always use the same aggregation (usually Sum) unless you change it. Also, calculated fields work best when the underlying data is numeric.
Common Problems and Solutions
Here are frequent issues when working with two columns in a pivot table:
- Values appear in separate columns but you want them in one column. Move one field below the other in the Values area to stack them vertically.
- Fields are not showing in the field list. Make sure your source data is formatted as a table (Ctrl+T) or that the range is correctly selected.
- Calculated field returns #DIV/0! errors. This happens when the denominator is zero. You can use
=IFERROR(Profit/Sales,0)in the formula, but note that IFERROR is not available in all Excel versions for calculated fields—it works in Excel 2010 and later. - Two columns in the Columns area create too many columns. If you have many items in the second field, consider moving it to Rows instead to keep the report readable.
Comparing Two Columns in a Pivot Table
Sometimes you need to compare two columns side by side, like this year vs. last year. The best approach is to add both fields to the Values area and then use the Show Values As option to display differences or percentages.
For example, to show the difference between Sales 2023 and Sales 2024:
- Add both Sales 2023 and Sales 2024 to Values.
- Right-click the second field and choose Show Values As > Difference From.
- Set Base Field to the year field (if you have a Year column) or use the previous field in the list.
This creates a new column showing the difference without altering the original data. On Mac, the menu is similar: right-click > Show Values As.
Alternatives to Pivot Tables for Two Columns
If a pivot table feels restrictive, consider these alternatives:
- Power Query – Merge or append columns before creating a pivot table. For example, combine First Name and Last Name into a single column using the Merge Columns feature.
- Formulas like SUMIFS – Use
=SUMIFS(Sales, Product, A2, Region, B2)to create a custom summary table without a pivot. - Charts – A clustered column chart can visually compare two columns of data, but it doesn’t replace a pivot table for tabular summaries.
Power Query is especially useful if you need to combine two text columns into one before pivoting—for example, merging “First Name” and “Last Name” into a single “Full Name” column. In Excel 365, go to Data > From Table/Range to open Power Query, then use the Merge Columns feature.
Frequently Asked Questions
Q: How do I combine two columns into one in a pivot table without changing the source data?
A: You cannot combine columns directly inside a pivot table; you need to either add both fields to the Rows or Values area, or create a calculated field. If you need a single column that concatenates text, use Power Query or a helper column in the source data.
Q: Why are my two value fields showing as “Sum of” and not as separate columns?
A: That’s normal—each field in the Values area appears as a separate column by default. If you see them stacked, it’s because they are in the same column position. Drag one field below the other in the Values area to stack, or side by side to show them as separate columns.
Q: Can I use a calculated field to subtract two columns?
A: Yes. Create a calculated field with a formula like =Sales - Cost. The field names must match your source data headers exactly. The result will be a new column in the pivot table.
Q: How do I show two columns as a percentage of a total?
A: Add both fields to Values, then right-click one field and choose Show Values As > % of Grand Total or % of Column Total. This replaces the raw numbers with percentages.
Q: What if my two columns are in different data tables?
A: You need to combine them into one table first, using Power Query (Data > Get Data) or by copying the data into a single sheet. A pivot table can only summarize data from one source range.
Related
- How to Calculate Battery Size for a Solar System
- Introduction to R Coding: Basics & First Steps
- Traffic Light Signal with Time Display: How It Works
Try it: the Percentage Formula Generator: percent of, percent change, increase and decrease, with the formula.
More in Charts & pivot tables
- Sparklines in Microsoft Excel 365: Create and Format ThemYes. Microsoft Excel for Microsoft 365 includes sparklines: tiny charts placed inside worksheet cells to show trends in…
- Line 3 of a Graph in Excel: How to Find and Format ItIn an Excel chart, “line 3” usually means the third data series—the third set of values drawn as…
- How to Edit the Chart Area in ExcelTo edit a chart area in Excel, select the chart, open the contextual Format tab, choose Chart Area…
- Refreshing Pivot Table Data: How to UpdateTo refresh a pivot table in Excel, right-click anywhere inside the pivot table and choose Refresh, or select…
- Excel Pie Chart Not Updating? Fix the Data Range NowAn Excel pie chart usually misses new data because its source range still ends at the old last…
- Excel Gantt Chart Template XLS: How to Find or Build OneYes—an Excel Gantt chart template can be opened or built in Excel, but “XLS” is the older Excel…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.