简体   繁体   English

Excel 数据透视表错误? 如果源表的文本列有月份名称,它会破坏数据透视表中的 AZ 排序

[英]Excel PivotTable bug? If Text column of source table has a month name, it breaks the A-Z sort in the pivot table

I have an Excel file which I can share with you, but here is how to recreate it:我有一个可以与您共享的 Excel 文件,但以下是重新创建它的方法:

  1. In a workbook tab, create a table called "DataTable" with the two "Company" and "Score" columns as shown below.在工作簿选项卡中,创建一个名为“DataTable”的表,其中包含两个“Company”和“Score”列,如下所示。

  2. Format the "Company" column explicitly as "Text".将“公司”列明确格式化为“文本”。 You can even precede the entries with single quotes to force Excel to treat them as Text : it won't change the behavior.您甚至可以在条目前加上单引号以强制 Excel 将它们视为 Text :它不会改变行为。

  3. Below this table, create a simple PivotTable on "DataTable" with "Company" as a Row Field and "Sum of Score" as a Value Field.在此表下方,在“DataTable”上创建一个简单的数据透视表,其中“Company”作为行字段,“Sum of Score”作为值字段。

  4. In the PivotTable, Sort the "Row Labels" (Company) field "AZ".在数据透视表中,对“行标签”(公司)字段“AZ”进行排序。

  5. You will see this, where the values "DEC" and "SEP" bubble to the top above the other AZ values:您将看到这一点,其中值“DEC”和“SEP”冒泡到其他 AZ 值上方的顶部:

数据透视表错误的屏幕截图

What apparently is happening is that Excel insists on treating anything that looks like a month name or abbreviation as its numeric equivalent, which sorts above the other AZ text values.显然正在发生的事情是 Excel 坚持将任何看起来像月份名称或缩写的内容视为其数字等效项,其排序高于其他 AZ 文本值。

  • Question 1: Is this a confirmed bug?问题 1:这是一个已确认的错误吗?
  • Question 2: How can I keep the desired values (like "SEP") but stop this from happening?问题 2:如何保持所需的值(如“SEP”)但阻止这种情况发生?

I am happy to upload an actual simple spreadsheet which shows this behavior.我很高兴上传一个实际的简单电子表格,它显示了这种行为。 Thanks!谢谢!

  1. Click on Row Labels Filter单击Row Labels过滤器
  2. Select More Sort Options选择More Sort Options
  3. Select More Options (Bottom Left)选择More Options (左下角)
  4. Uncheck Sort Automatically every time the report is updated取消选中Sort Automatically every time the report is updated
  5. Ensure First key sort order = No Calculation确保First key sort order = No Calculation
  6. Refresh Pivot Table刷新数据透视表

在此处输入图片说明

That's because Excel thinks SEP and DEC are months names and sorts them according to Custom Lists .这是因为 Excel 认为SEPDEC是月份名称并根据Custom Lists对它们进行排序。 To prevent this, you need to go to PivotTable -> Options and uncheck Use custom Lists when sorting in the Totals & Filters tab为防止出现这种情况,您需要转到PivotTable -> Options并取消选中在Totals & Filters选项卡中Use custom Lists when sorting

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM