简体   繁体   English

按月和年对“日期”列进行排序

[英]Sort Date column by month and year

I have date format like "MM-dd-YYYY" in Excel file. 我在Excel文件中有类似“ MM-dd-YYYY”的日期格式。 I would like to know if how can I sort it by month and year ? 我想知道如何按月和年对它进行排序?

Because when I sort, the 'year' doesn't work when we have different year like '2017' '2018'. 因为当我进行排序时,当我们使用不同的年份(如“ 2017”,“ 2018”)时,“年份”不起作用。

Thanks 谢谢

  1. Convert your data to proper date format first. 首先将数据转换为正确的日期格式。 to do so perfom following steps:- 为此,请执行以下步骤:

a.Simply select your dates in column A > Data tab of the ribbon > Text to Columns to open the Wizard: 只需在功能区的A列> Data选项卡> Text to Columns中选择日期,以打开向导:

Step 1 of the Wizard: Choose 'Delimited' Step 2 of the Wizard: uncheck all Delimiters (just to be safe) Step 3 of the Wizard: Choose 'Date' from the 'Column Data Format' options and choose your date format from the drop down list , and click the Finish button: 向导的第1步:选择“定界”向导的第2步:取消选中所有定界符(为安全起见)向导的第3步:从“列数据格式”选项中选择“日期”,然后从下拉列表,然后单击完成按钮:

Tip: Note how the 'Date' drop down list above has many different combinations of DMY, you simply choose what order your dates are formatted in from the list. 提示:请注意上面的“日期”下拉列表如何具有DMY的许多不同组合,您只需从列表中选择日期的格式顺序即可。

now sort your data and it will work as you want it to. 现在对数据进行排序,它将按您希望的那样工作。

Check here for more: 在这里查看更多:

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

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