ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table sorting (https://www.excelbanter.com/excel-programming/351051-pivot-table-sorting.html)

LadyReader

Pivot Table sorting
 
I have some data being exported daily from SQL into Excel. A pivot
table is applied to the data with the columns of the table being the
WeekEnding dates. Although the field format is "date" in both the raw
data and the pivot table column, the pivot table is sorting the columns
according to alphabetic rules; e.g 01/20/2007 sorts before 01/21/2006.
And I do have the autosort option set to ascending for WeekEnding.

Can someone suggest how to get these columns to sort ascending?

Thanks.


Jim Thomlinson[_5_]

Pivot Table sorting
 
It sounds to me like you do not actually have dates in your source data but
rather you have text. To confirm this select the datss on the raw data and
try to format them to some other date format. If they won't format then you
have text. Assuming that to be the case you can try doing a find and replace
on the column replacing 0 with 0. Oddly enough when you do that Excel
performs an implicit conversion and changes the text to dates (usually). When
that is completed go to your pivot table and refresh it twice. You have to do
it twice for the change to take effect (just a weird quirk with pivot
tables). Let me know how it goes.
--
HTH...

Jim Thomlinson


"LadyReader" wrote:

I have some data being exported daily from SQL into Excel. A pivot
table is applied to the data with the columns of the table being the
WeekEnding dates. Although the field format is "date" in both the raw
data and the pivot table column, the pivot table is sorting the columns
according to alphabetic rules; e.g 01/20/2007 sorts before 01/21/2006.
And I do have the autosort option set to ascending for WeekEnding.

Can someone suggest how to get these columns to sort ascending?

Thanks.



LadyReader

Pivot Table sorting
 
Jim, thanks for responding. While waiting for a reply to my question, I
went searching on the web for an answer and came up with the same issue
you noted. My date column wasn't really a date, although it sure looked
like it. I rewrote the SQL export job and manually set to destination
table field to date, and it worked.
Thanks again!



All times are GMT +1. The time now is 12:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com