Custom Sorting

In the above (obviously contrived) example, a company changed accounting systems. Any open projects at the time were converted to the new system, but were assigned new project numbers and names. Now the company needs to sort the reports by project number, but they want those jobs that have two different numbers to remain together.

To accomplish this, we need a new column (that we will be sorting on) and a lookup table showing both the old and new project numbers.

The new Sort Project column uses this formula:

=IF(ISNA(MATCH(A2,$E$2:$E$3,FALSE)),A2,VLOOKUP(A2,$E$2:$F$3,2,FALSE))

That says: if you can’t find this project in column E, give me column A, otherwise give me column F. Now I can sort on column C and get Project One and New Project One sorted together.

Posted in Uncategorized

4 thoughts on “Custom Sorting

  1. Everyone was impressed. I tell them your excel wisdom is endless… You can do anything! Thanks again for your help. :)

  2. To achieve sorting by project number while keeping projects with different numbers together, create a new column for sorting and establish a lookup table mapping old and new project numbers.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.