Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Data sorting problem

Excel 2003

I have a pivot table which draws data from a sheet in my workbook that is
constantly being updated. After I update the data, I update and sort the
pivot table with:

ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh
ActiveSheet.Range("K").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers

Column K has data in it that looks like this before the sort:

22900400000F-GW
542A0612-13(L)S
2312120000000ME
etc€¦

After the sort of column K and performing some LEFT, MID and RIGHT functions
on the data, putting the results into columns A to D , some of the data in
column A looks like this:

229
230
2306
2309
231
2312
2313
233
etc€¦

I would like the data to be sorted like this:

229
230
231
233
..
542
542A
..
2306
2309
2312
2313
etc€¦

What change to the sort coding do I have to do to have the data in the order
I want?

TIA
David

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Data sorting problem

Use the Value( ) function around the info in Col A to make them numbers
instead of text. They will then sort the way you want.
--
Hope this helps.
Thanks in advance for your feedback.
Gary Brown


"Compass Rose" wrote:

Excel 2003

I have a pivot table which draws data from a sheet in my workbook that is
constantly being updated. After I update the data, I update and sort the
pivot table with:

ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh
ActiveSheet.Range("K").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers

Column K has data in it that looks like this before the sort:

22900400000F-GW
542A0612-13(L)S
2312120000000ME
etc€¦

After the sort of column K and performing some LEFT, MID and RIGHT functions
on the data, putting the results into columns A to D , some of the data in
column A looks like this:

229
230
2306
2309
231
2312
2313
233
etc€¦

I would like the data to be sorted like this:

229
230
231
233
.
542
542A
.
2306
2309
2312
2313
etc€¦

What change to the sort coding do I have to do to have the data in the order
I want?

TIA
David

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Data sorting problem

Gary, thanks for the response.

The problem is that column A isn't sorted - column K, which is one of the
columns in the pivot table, is the one that is sorted. Column A is populated
by applying a formula to all the rows in column K after it is sorted. The
formula that I use in column A is:
=IF(MID(K1,4,1)="0",LEFT(K1,3),LEFT(K1,4))

How can column K be sorted to give the results I'm looking for?

David

"Gary Brown" wrote:

Use the Value( ) function around the info in Col A to make them numbers
instead of text. They will then sort the way you want.
--
Hope this helps.
Thanks in advance for your feedback.
Gary Brown


"Compass Rose" wrote:

Excel 2003

I have a pivot table which draws data from a sheet in my workbook that is
constantly being updated. After I update the data, I update and sort the
pivot table with:

ActiveSheet.PivotTables("PivotTable1").PivotCache. Refresh
ActiveSheet.Range("K").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom, DataOption1:=xlSortTextAsNumbers

Column K has data in it that looks like this before the sort:

22900400000F-GW
542A0612-13(L)S
2312120000000ME
etc€¦

After the sort of column K and performing some LEFT, MID and RIGHT functions
on the data, putting the results into columns A to D , some of the data in
column A looks like this:

229
230
2306
2309
231
2312
2313
233
etc€¦

I would like the data to be sorted like this:

229
230
231
233
.
542
542A
.
2306
2309
2312
2313
etc€¦

What change to the sort coding do I have to do to have the data in the order
I want?

TIA
David

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Data Sorting Problem Dado Excel Discussion (Misc queries) 2 August 29th 09 10:10 PM
problem sorting data clcnewtoaccess Excel Discussion (Misc queries) 5 February 9th 09 08:00 PM
Data sorting problem Gracewood Excel Discussion (Misc queries) 2 May 31st 08 01:42 AM
Problem sorting data scottydel Excel Programming 6 July 28th 07 01:27 PM
Problem with Sorting Data reggiebu Excel Discussion (Misc queries) 2 June 9th 05 09:37 PM


All times are GMT +1. The time now is 05:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"