简体   繁体   中英

optimally grouping dates by month in pivot

My data is organized by: Day, Month, Year and I'd like it to be grouped by Month, Year so as to properly have it summed up in a pivot.

However, when setting the date to mmm, yy format, the pivot still acts as if there are individual days, so my pivot filter has 30 cases of Apr, 16 .

If I do this by converting date to text with =text(B2,"mmm, yy") then the chronological order is lost in the pivot and all I get is some phony alphabetical order by months, and using "mm" instead is no better (the data gets ordered 1, 10, 11, 12, 2, 3...9 ).

My current formula is =date(right(B2,4)&left(B2,2),1)

where B column has =text(X2,"mm - yyyy")

where X column has dates by day

I'm seeking a way to do this without helper columns and seemingly redundant operations like the formula below:

=date(right(text(X2,"mm - yyyy"),4),left(text(X2,"mm - yyyy"),2),1)

=date(right(text(X2,"mm - yyyy"),4),left(text(X2,"mm - yyyy"),2),1)

事实证明,这是解决此问题的最简单方法,因为将它们全部按1 / mm / yyyy排序可以将它们组合到一个数据透视表中,同时将格式更改为“ mm-yyyy”可以使我的数据透视表日期按预期显示

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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