Sort Cell Data Seperated By Pipe Separator (|)

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • I have a multiple cells with values similar to the following:

    I need to reorder the value to read:

    With VBA, could you give me some advice.

  • Re: Sort Cell Data Speparated By "|"

    Obviously, you will need to:

    - split the cells based on the pipe separator
    - sort them
    - put them back together




    Excel MVP 2011-2014

    For more Excel memes: visit ==> English articles ==> Excel memes

    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

  • Re: Sort Cell Data Speparated By "|"

    Well, using the macro recorder I got the below code. I started with your
    example (P442-C|P642-C|P342-C|P842-C) in A1. Coppied it to D1 and then did a text to column, copied and pasted special/transpose to d3, sorted,
    then reconstructed in d8 and copied and pasted special/value to A2

    You should be able to modify to loop through your sheet or copy to different location

  • Re: Sort Cell Data Speparated By "|"

    Awesome! Learn something new everyday. Thank you for the information and direction. I can use this technique to do exactly what I want.

    Thanks again.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!