PDA

View Full Version : Pivot Table: Sort rows according to columns



Jubinell
11-29-2007, 12:56 PM
Hi,

I have a dataset with the following headers:
Contact, Account, Date, where there can be multiple contacts at an account, and each contact can have multiple dates, and even multiple entries of the same dates. I have sorted the dataset by account, then by contact, then by date (I don't think this matters for the pivot table though).

I then create a pivot table to show the list of accounts vertically, and the list of start dates horizontally. The cell entries show counts of dates that correspond with each account.

Here is my question:

I would like to sort the rows (accounts) in the pivot table such that the ones with the earliest first date shows up first.

For example, if account X has dates 1/1, 1/2, 1/3, account Y has dates 1/1, 1/5, 1/10, and account Z has dates 1/20, 2/20, my list will look like this:

X
Y
Z

Can this be done without VBA?

Ideally, I'd like to define my sort more precisely. For example, if two accounts have the same dates, then the ones with more of the first dates will be listed first. To illustrate, if X has 5 1/1 and 5 1/2, and Y has 4 1/1 and 5 1/2, then X will be listed first. But I understand this is complicated and I am not too concerned about it for now.

Thanks for your help,