The information in this article applies to:
SUMMARY
In Microsoft Excel, data in a PivotTable is automatically sorted.
There are no options available to turn this automatic sorting off or
to perform a custom sort on your PivotTable data.
MORE INFORMATION
Similar to when data is sorted on a worksheet, a PivotTable will first use
a custom list to sort if possible. If an appropriate custom list is not
available, then the PivotTable uses default sorting.
Example Using a Custom ListCreating the PivotTable
Creating the Custom ListTo create a custom list to affect the way your PivotTable data is sorted, first make sure that the cells from which you are creating the list contain text, not formulas or numeric values. If the cells contain formulas, you must first copy the formulas, and then paste the values to another location to create text; if the cells contain numeric values, you will not be able to create a custom list, even if you format the values as text.
Using the Custom ListTo use this custom list to sort your PivotTable, you must delete the PivotTable created above, and then create the PivotTable again, using the steps in the "Creating the PivotTable" procedure.NOTES: If you add items to the source data after you create the PivotTable, and you refresh the PivotTable, the new items are only sorted correctly if they are included in the original custom list. Items that are not included in the original custom list are sorted after the items that are included in the original custom list. After you create a PivotTable using a custom list, the PivotTable no longer uses the custom list for refreshing the data. Because of this behavior, if you change the custom list that you used to create the PivotTable, you must delete the PivotTable, and create a new PivotTable. Additionally, you can delete the original custom list and the PivotTable will still sort according to the original custom list. Visual Basic Code ExampleThe following example shows how to make a PivotTable field appear not to sort using a Visual Basic macro:
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.asp Additional query words: disable stop sorting 5.00c
Keywords : kbcode kbprg kbualink97 |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |