Sub topic 10
Fixing "Cannot group that selection"
This chapter assumes you can build a PivotTable, you know how to open the Grouping dialog (right-click a field item, then choose Group), and you have grouped dates or numbers at least once. It also assumes your source data is a table or a contiguous range with one header row.
What the error means
When you click OK in the Grouping dialog, Excel reads every value of the field in the PivotTable cache. The cache is the copy of the source data that the PivotTable stores. Excel can build date or number groups only if every value in the field is a real date or number. If it finds anything else, it shows this message and groups nothing:
The message does not say which cell caused the problem or why. You have to find the cause yourself. Most of the time the cause is in the source data, not in the PivotTable.
A diagnostic order
Work through the causes in order of how often they occur. Each check takes under a minute.
Cause 1: Dates stored as text
This is the most common cause. Dates imported from a CSV file, a web page, or another system often arrive as text that only looks like a date. Excel cannot turn text into date groups.
Signs of text dates:
- The values are left-aligned in their cells, while real dates are right-aligned by default.
- The Number Format box on the Home tab shows General or Text, not Date.
- A green triangle appears in the corner of the cell.
- In the PivotTable, each date appears as a separate item and you cannot expand it by month or year.
Test one cell with ISNUMBER:
=ISNUMBER(A2)This returns TRUE for a real date or number and FALSE for text. To test the whole column at once, compare the number of cells with the number of numeric cells. Assume the data is in A2:A501:
=ROWS(A2:A501)-COUNT(A2:A501)COUNT counts only numeric cells, and dates are numeric. A result of 0 means every cell is a real date or number. Any other result is the number of cells that are text, blank, or errors.
To find the bad rows, put =ISNUMBER(A2) in a helper column next to the data, copy it down, and filter that column for FALSE.
Converting text to real dates
Changing the cell format to Date does not convert text that is already in the cell. Excel only reformats a text cell after you edit it again. Use one of these methods instead:
- Text to Columns. Select the column, then choose Data, then Text to Columns. Click Next twice. In step 3, choose Date and pick the order that matches your text (MDY, DMY, or YMD). Click Finish. The conversion happens in place.
- Multiply by 1. Type 1 in an empty cell and copy it. Select the text dates, choose Paste Special, then Multiply. This works only when Excel already recognizes the text as a date in your regional settings.
- A formula in a helper column. This is useful when the text has stray spaces:
=DATEVALUE(TRIM(A2))DATEVALUE converts date text into a serial number, and TRIM removes extra spaces. If the text came from a web page, it may contain non-breaking spaces (character 160), which TRIM does not remove. In that case, use this:
=DATEVALUE(TRIM(SUBSTITUTE(A2,CHAR(160)," ")))Format the result column as a date. Then base the PivotTable on the helper column, not the original text column. DATEVALUE depends on your regional date settings. Text such as 03/04/2026 may read as 4 March or 3 April depending on your system, so check a few results by eye.
Cause 2: Blank cells in the field
A blank cell is not a date and not a number. A date field that contains blank cells commonly produces this error, for example when an order has no ship date yet. Use COUNTBLANK to check:
=COUNTBLANK(A2:A501)You have four options:
- Delete the rows if they are not needed.
- Fill the blank cells with a real date, if a sensible value exists.
- Use a helper column that replaces blanks with a placeholder date, then filter the placeholder out of the PivotTable after you group. For example,
=IF(ISNUMBER(A2),A2,DATE(2000,1,1))turns blanks and text into 1 January 2000. Choose a placeholder far from your real data so it is easy to spot and filter. - Filter the source data to remove the blank rows before you build the PivotTable.
Do not use =IF(A2="","",A2) as the fix. The empty string "" is text, so it causes the same error.
In numeric fields, whether blanks block grouping can depend on the Excel version. Text in a numeric field always blocks it. If a numeric field fails and you cannot find text, test with the blanks removed.
Cause 3: Error values and mixed types
A single #N/A, #DIV/0!, or #VALUE! in the source column stops grouping. This often happens when the column is itself a formula, such as a lookup that failed. Use Home, then Find & Select, then Go To Special, then Formulas, and tick only Errors. That selects every error cell in the sheet. Fix the formulas, or wrap them:
=IFERROR(VLOOKUP(E2,Lookup!A:B,2,FALSE),0)For a numeric field, use 0 only if zero is a meaningful value. Otherwise zero will create a misleading bucket.
Mixed content is a related problem. A numeric field might contain mostly numbers plus a few entries such as "n/a", "TBD", or "12 units". The text entries cause the error even though most cells are fine. Filter the helper ISNUMBER column for FALSE to find them.
Cause 4: Selecting the wrong thing
The error also appears when the selection is the problem, not the data. Check these cases:
- Grand Total or Subtotal cell. These cells are not field items. Select a real item in the Row Labels or Column Labels area.
- A cell in the Values area. Grouping works on row and column items, not on summed numbers.
- Manual text grouping with an empty or mixed selection. Select two or more items in the same field, using Ctrl+click, then right-click and choose Group.
- A field that is only in Filters. Move it to Rows or Columns first.
If the Group command is grayed out or missing, the cause is usually the selection or the data source type, not the data values.
Cause 5: Stale cache and Data Model sources
After you correct the source data, the PivotTable still holds the old cache. The error will persist until you refresh. Use Alt+F5 or Data, then Refresh All. If the error remains, check that the PivotTable's source range covers the corrected cells. Choose PivotTable Analyze, then Change Data Source, and confirm the range. Using an Excel table as the source avoids range problems because the range grows with the table.
PivotTables built on the Data Model, which is the option "Add this data to the Data Model" when you create the PivotTable, behave differently. Newer Excel versions can group date fields automatically there, but the Grouping dialog is limited or unavailable for number ranges and manual groups. If you need those, put the field's bucket logic in a helper column in the source data. The helper column approach is also covered in the chapter on helper columns for fiscal years and custom buckets.
Summary of causes and fixes
| Cause | How to detect | Fix |
|---|---|---|
| Dates stored as text | `ISNUMBER` returns FALSE, values left-aligned | Text to Columns, `DATEVALUE`, or re-enter |
| Blank cells in a date field | `COUNTBLANK` is above 0 | Delete, fill, or use a placeholder in a helper column |
| Error values | Go To Special, Errors | Fix the formulas or wrap with `IFERROR` |
| Text mixed into numbers | `ROWS` minus `COUNT` is above 0 | Clean or remove the text entries |
| Wrong selection | Total or Values cell selected | Select a real row or column item |
| Stale cache | Source fixed, error remains | Refresh, then check the data source range |
Worked example
You have 500 orders in A2:A501 and the date field fails to group.
- In G1, enter
=ROWS(A2:A501)-COUNT(A2:A501). It returns 14, so 14 cells are not numeric. - In B2, enter
=ISNUMBER(A2)and copy it down to B501. Filter column B for FALSE. You see 9 text dates such as2026-03-14with a trailing space, and 5 blank cells. - In C2, enter
=DATEVALUE(TRIM(A2))for the text rows. You paste the converted values back into column A as values, replacing the text. - The 5 blank cells are orders not yet shipped. You decide these rows do not belong in a monthly report, so you delete them.
- Re-enter
=ROWS(A2:A496)-COUNT(A2:A496)over the remaining 495 rows. It returns 0. - Refresh the PivotTable. Right-click a date, choose Group, select Months and Years, and click OK. The grouping now works.
Keep the cleaned data as the source going forward. If the data keeps arriving from a system that produces text dates, put the conversion in a helper column once and point the PivotTable at that column.
Preventing the error
- Keep the source as an Excel table, so new rows follow the same column formats.
- Add a check cell next to the data that uses
ROWSminusCOUNTand shows a warning when it is not 0. - Do not leave placeholders such as "N/A" or "-" in date and number columns.
- Format date columns as Date before you paste in data, and use Text to Columns on imports that arrive as text.
Exercise
A PivotTable's Order Date column contains 1,200 rows. The formula =ROWS(A2:A1201)-COUNT(A2:A1201) returns 6, and grouping gives "Cannot group that selection". Name two possible causes of the 6 and one formula-based way to find the exact rows.
Show answer
The 6 cells are not numbers, so they could be text dates (for example from an import), blank cells, or error values. To find them, put =ISNUMBER(A2) in a helper column, copy it down, and filter the column for FALSE. The filtered rows are the ones to convert, fill, or delete. After fixing them, refresh the PivotTable and group again.
Exercise
You fixed all the text dates in the source column, but the PivotTable still shows the error when you try to group. What are the next two things to check?
Show answer
First, refresh the PivotTable (Alt+F5 or Data, then Refresh All), because the cache still holds the old text values. Second, check Change Data Source to confirm the source range includes the corrected cells. If it is a Data Model PivotTable, also remember that the Grouping dialog may be limited, and a helper column may be needed.