Pivot Table Issues

Filter Excel PivotTable Results by a Location in a Multi-Value Cell

Huda QurayshiHuda Qurayshi Dec 2, 2026 868 views

Question details

Show parts in a PivotTable when a selected location appears in a comma-separated list of locations.

Filter Excel PivotTable Results by a Location in a Multi-Value Cell
Product
Microsoft Excel PivotTable and Power Query
Device & OS
not provided
Scenario
A source table lists multiple locations in one cell for each part, and the user wants to filter the results by one location, such as MAIN.
Observed behavior
A standard PivotTable filter treats the entire comma-separated cell as a single value rather than as separate locations.
Before you start

Check that your source data has headers for the part, location, and quantity columns. Confirm that commas separate locations and are not part of the location names.

Solution 1Recommended

Split locations into rows with Power Query

Use this method to create a separate PivotTable filter value for each location.

1
Open the source in Power Query

Select a cell in the source data, then choose Data > From Table/Range. Confirm that the table has headers if prompted.

2
Split locations into rows

In Power Query, select the Location column and choose Split Column > By Delimiter. Select Comma, open Advanced options, choose Split into Rows, and select OK.

3
Remove extra spaces

With the Location column selected, choose Transform > Format > Trim. Check that each part-location combination is on its own row.

4
Load the normalized table

Choose Home > Close & Load to load the transformed data into Excel.

5
Build and filter the PivotTable

Select the loaded table and choose Insert > PivotTable. Add Part to Rows, Quantity to Values, and Location to Filters; select MAIN in the Location filter. Alternatively, add Location with PivotTable Analyze > Insert Slicer.

Split locations into rows with Power Query
Check totals across locations: Splitting into rows repeats a part's quantity for each listed location. A single-location total includes each matching source row, but a grand total across locations can count the same quantity more than once. When the source changes, use Data > Refresh All.
Filter locations in WPS Spreadsheet

Filter a PivotTable by location in WPS Spreadsheet

Use a helper column in WPS Spreadsheet to flag rows containing a selected comma-separated location, then filter those rows in a PivotTable.

  1. 1. Open your workbook: Open the Excel workbook in WPS Spreadsheet and locate the source table containing parts, locations, and quantities.
  2. 2. Enter a location: Type a nonblank location such as MAIN in F1, outside the source data. The following formula assumes the location list is in B2.
  3. 3. Flag matching rows: Add a Location Match header to an empty source column. In row 2, enter =IF(ISNUMBER(SEARCH(","&SUBSTITUTE(TRIM($F$1)," ","")&",",","&SUBSTITUTE(B2," ","")&",")),"Match","") and fill it down. The formula ignores case and ordinary spaces, so avoid it if spaces distinguish location names.
  4. 4. Create the PivotTable: Select the source data, including the helper column, and choose Insert > PivotTable. Add Part to Rows, Quantity to Values, and Location Match to Filters.
  5. 5. Show matching parts: Select Match in the Location Match filter. If you change F1, refresh the PivotTable and check that Match is still selected.
Find a complete location within a comma-separated cellKeep each matching source row intact for a single-location summaryOpen and work with Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the PivotTable list each location separately?

The PivotTable sees each source cell as one value. Use Data > From Table/Range and split the Location column by comma into rows in Power Query to make individual locations available.

Can I use a slicer to select MAIN?

Yes. After splitting locations into rows and creating the PivotTable, select it and choose PivotTable Analyze > Insert Slicer. Select Location, then choose MAIN in the slicer.

Will splitting locations change the quantity total?

It repeats each source row's quantity for every listed location. A total filtered to one location includes matching rows, but an unfiltered grand total can count quantities more than once.

How do I update the results when the source data changes?

In Excel, choose Data > Refresh All to update the Power Query output and PivotTable. If you use a helper formula instead, refresh the PivotTable after changing the selected location.

Does the helper formula match MAIN inside MAIN2?

No. The formula searches for the location between comma boundaries, so MAIN does not match MAIN2. It ignores case and ordinary spaces, however, so it is unsuitable if spaces distinguish location names.