Adding a Custom Order in Excel Sort

124 views Asked by At

I am trying to Custom sort a Columns with order like for eg: "A,2015,B,2015".

Here A,2015 is One Term. But Since each Term here is Separated by Comma, The order will have a issue, How will I be able to add the Comma in the Custom Order List

When I add A,2015 in Custom Order, It takes as
A
2015
B
2015

But I want it as
A,2015
B,2015
as the Sorting Order

1

There are 1 answers

0
Ron Rosenfeld On

I don't know that you can do this with commas in custom list items used for sorting, even though you can certainly add items containing a comma to a custom list.

Several work-arounds:

  • Replace the commas in both the custom list and your data with some other character that does not occur in the data; sort it, then return to the original (or sort on a helper column where you have replaced the comma; then delete the helper column).
  • If there will just be a single comma, as you show in your example:
    • Split the data on the comma
    • Sort on the two columns (using custom sort if needed)
    • Delete (or recombine, depending on how you did the split) the two columns
  • Write a custom sort VBA routine
  • The first two methods can also be automated using VBA, if necessary.