How to Fix If a Pivot Table Field Name Already Exists (2 Methods)

The dataset below contains some salespersons’ sales, units, and corresponding regions.


Method 1 – Using Different Custom Names

Steps:

  • Select any data from the dataset.
  • Click as follows: Insert > Pivot Table.

A dialog box named Create PivotTable will appear.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

  • Select the data range; you can change the range according to your wish.
  • Select the worksheet- New worksheet/ Existing Worksheet. I’ve chosen the New worksheet option.
  • Click OK.

Pivot Table Fields will open up.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

  • Drag Salesperson to the ROWS field and Units to the VALUES field.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

Your Pivot Table will look like the image below. Excel has automatically changed the unit’s name to Sum of Units, but our headers’ name was Units. Let’s try to change the name.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

  • Double-click on the title ‘Sum of Units’.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

The Value Field Settings dialog box will appear.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

  • Change the name from the Custom Name section.
  • Type Units and click OK.

Different Custom Name to Solve If a PivotTable Field Name Already Exists

It will then show, “Pivot table field name already exists,” because our dataset has the same name.

  • The simple solution is to type a space before or after the name. Excel will accept it.
  • Click OK.

Now take a look that the name has been changed successfully.


Method 2 – Using VBA Macros

Steps:

  • Select any cell of the dataset.
  • Click as follows: Insert > Pivot Table.

VBA Macros to Solve If a PivotTable Field Name Already Exists

  • After appearing in the Create PivotTable dialog box, select the data range and select New worksheet or Existing worksheet as you desire. I selected New worksheet.
  • Press OK, and you will then get the PivotTable Fields dialog box.

VBA Macros to Solve If a PivotTable Field Name Already Exists

  • Drag Salesperson to ROWS field and Units and Sales to VALUES field.

VBA Macros to Solve If a PivotTable Field Name Already Exists

Your Pivot Table will look like this. If we try to change the title names Sum of Units to Units and Sum of Sales to Sales, we’ll face the problem—“Pivot table field name already exists”—as we used these names in our dataset.

VBA Macros to Solve If a PivotTable Field Name Already Exists

  • Open the VBA window.
  • Right-click the sheet title and click the View Code option from the context menu.

  • Enter the following formula:
Sub PivotTable_AlreadyExists()
Dim Pfield As PivotField
Dim PTable As PivotTable
Set PTable = ActiveSheet.PivotTables(1)
For Each Pfield In PTable.DataFields
    Pfield.Caption = Pfield.SourceName & " "
Next Pfield
End Sub
  • This code will change all the source field names with a space after the names.
  • Click the Run icon to run the codes. A Macros dialog box will open up.

  • Select the Macro as we specified in the codes.
  • Press Run.

You will see that all the source names are changed successfully without trouble.

Read More: Excel VBA to Get Pivot Table Field Names


Download the Practice Workbook

You can download the free Excel template from here and practice independently.


Further Readings


<< Go Back to Pivot Table Field List | Pivot Table in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

1 Comment
  1. Excellent – saved me a lot of time!

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo