简体   繁体   English

Excel 日期过滤器不分组日期

[英]Excel Date Filter not grouping dates

I am pulling data from another spreadsheet and have a filter on the column header.我正在从另一个电子表格中提取数据,并且在列标题上有一个过滤器。 The dates range from 2015 to 2018 off all months, weeks and days.日期范围从 2015 年到 2018 年不等,所有月、周和日都没有。 Some of the dates are not grouping eg 15/03/2018 is loose underneath the 2018, 2017, 2016 and 2015 collapsible boxes.某些日期未分组,例如 15/03/2018 在 2018、2017、2016 和 2015 可折叠框下方松散。

All dates has come from the same source spreadsheet and the Marco formats them all as did/mm/yyyy when copying over.所有日期都来自同一个源电子表格,Marco 在复制时将它们全部格式化为 did/mm/yyyy。

I solved a similar problem by copying the column to notepad, and reinserting it.我通过将列复制到记事本并重新插入来解决了类似的问题。 After this all dates were in the same format.在此之后,所有日期都采用相同的格式。

Make sure Excel recognizes the whole column as a set of dates.确保 Excel 将整列识别为一组日期。

Grouping requires all cells to be formatted as dates.分组要求所有单元格都设置为日期格式。 Grouping will only work if there are no empty or text cells in a range and all cells have the same date format.仅当区域中没有空单元格或文本单元格且所有单元格具有相同的日期格式时,分组才有效。

You may try the following steps to correct number format in the range:您可以尝试以下步骤来更正范围内的数字格式:

  • remove any number formats (Home -> Clear -> Clear Formats...).删除任何数字格式(主页 -> 清除 -> 清除格式...)。 After this step your date values shall look like numbers (eg 43284, 43285 etc.)在这一步之后,您的日期值应该看起来像数字(例如 43284、43285 等)
  • (optional) multiply the whole range by 1 (Copying "1" from a single cell and using "Paste Special"). (可选)将整个范围乘以 1(从单个单元格复制“1”并使用“选择性粘贴”)。 This step effectively converts all cell formats to numeric此步骤有效地将所有单元格格式转换为数字
  • (optional) use filter to check if there are any empty / text cells left and fill them with numeric values (eg zeroes) (可选)使用过滤器检查是否还有空/文本单元格,并用数值(例如零)填充它们
  • finally, apply the date format (Home -> Number -> Long Date)最后,应用日期格式(Home -> Number -> Long Date)

I have found the formula DATE(YEAR(a1),MONTH(a1),DAY(a1)) will translate both strings that look like dates and actual dates into a date format.我发现公式DATE(YEAR(a1),MONTH(a1),DAY(a1))会将看起来像日期和实际日期的字符串转换为日期格式。

Filtering and sorting behavior should then be consistent down the column.过滤和排序行为应该在列中保持一致。

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

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