Pivot Table Sorting Dates Out of Order

errollflynn

New Member
Joined
Jan 25, 2021
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a data table with the start date and another column that uses several formulas to extract the month and year from the start date. I created a pivot table with the data set but the date columns are being shown out of order. I have tried formatting the column as dates but the result is the same.

aeg4_caps_payroll_report_2022-01-01_thru_2023-08-01 NY.xlsx
EFGH
1Start DateShiftMonthMonth/Year
22/14/202200Feb-2022
32/14/202210Feb-2022
42/23/202210Feb-2022
52/24/202200Feb-2022
62/24/202210Feb-2022
72/25/202211Feb-2022
83/4/20221 Mar-2022
93/12/202311Mar-2023
104/1/202310Apr-2023
114/7/202310Apr-2023
124/8/202310Apr-2023
134/18/202311Apr-2023
145/16/202310May-2023
Bowery NY
Cell Formulas
RangeFormula
F2:F14F2=IF(E2<>E3,1,0)
G2:G14G2=IF(AND(B2=B3, YEAR(E2)=YEAR(E3)),MONTH(E3)-MONTH(E2),"")
H2:H14H2=CONCATENATE(TEXT(E2, "MMM"), "-",YEAR(E2))




aeg4_caps_payroll_report_2022-01-01_thru_2023-08-01 NY.xlsx
BCDEFGHIJKL
3Column Labels
4Apr-2022Apr-2023Aug-2022Aug-2023Dec-2022Feb-2022Feb-2023Jan-2022Jan-2023Jul-2022Jul-2023
Sheet1


Thank you for your help.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
My thought is that you are now trying to sort a text string as a value.

Instead of concatenating MMM-YYYY into text, just format the cells in Column H as "MMM-YYYY".
If you are concerned with multiple days in there, make the formula in column H this: Date(Year(E2),Month(E2),1)
 
Upvote 0
Solution
My thought is that you are now trying to sort a text string as a value.

Instead of concatenating MMM-YYYY into text, just format the cells in Column H as "MMM-YYYY".
If you are concerned with multiple days in there, make the formula in column H this: Date(Year(E2),Month(E2),1)
Thank you!
 
Upvote 0
My pleasure. I am happy you found a solution here.

Best Wishes!
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top