Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #28693

    This can be an extra option in the Sort options, implemented in the following ways:

    1. On row level (as separated by columns)
    2. On delimiter level. Could be a selection box and an option for custom delimiter (supporting multi-character delimiters), I.e. [space][comma]

    How does it work? See here (columns only)


    There’re different way for sorting column, such as A-Z, Z-A, 0-9, shortest – longest……
    If having sorting row feature, wish to have same options.

    Yutaka Emura

    This macro will sort (A to Z, case insensitive) by row level at the current cursor (or selected cell) line. You can use this macro to develop further for different sort criteria.

    function SortOneColumn( yLine )
        count = document.GetColumns();
        arr = new Array(count);
        for( i = 0; i < count; ++i ) {
            s = document.GetCell( yLine, i + 1, eeCellIncludeNone );
            arr[i] = { name: s, col: i };
        arr.sort( function( a, b ) {
          var nameA =;
          var nameB =;
          if( nameA < nameB ) {
            return -1;
          if( nameA > nameB ) {
            return 1;
          return 0;
        bSorted = false;
        for( i = 0; i < count; ++i ) {
            if( arr[i].col != i ) {
                document.MoveColumn( arr[i].col + 1, arr[i].col + 1, i + 1 );
                bSorted = true;
        return bSorted;
    yLine = document.selection.GetActivePointY( eePosLogical );
    while( SortOneColumn( yLine ) );

    I am not sure what you mean by 1. On delimiter level.


    Imagine Excel, I mean being able to sort multiple entries left to right in one cell, separated by a delimiter, I.e. comma.
    And this procedure to the totality of selected rows.

    Yutaka Emura

    I am still not sure if I understand your question, but if you are talking about a nested CSV like this page:

    and if you would like to sort, for instance, “apple;banana;cherry“, you can select “Split Columns” while selecting the second column, select (None), enter the separator (a semicolon in this case), set the Sort split strings option, and select a desired sort criterion.


    I tried the way you described, did not work as expected, created columns instead.

    I mean like having multiple lines like these:

    stuff, apple, banana, cherry, all
    sort, more, mpme, stuff, apple, banana, cherry, all

    Then simply running horizontal sort, and the end results being with A-Z sort

    all, apple, banana, cherry, stuff
    all, apple, banana, cherry, more, mpme, sort, stuff

    Of course it would be good if one could define the delimiter in the process.

    Yutaka Emura

    OK. I now understand your question.

    Currently, you can select a CSV mode (for instance Tab-separated, NOT Comma-separated) so that only one column should exist. Select the only one column, select the Split Columns command, then select (None), enter the Separator (Comma + Space in this case), set the Sort split strings option, and select a desired sort criterion.

    Alternatively, you can split to multiple lines by replacing Comma + Space with a newline, sort, and then replace a newline with Comma + Space to restore newlines.

    I will think about a new command in the future.


    Here is an Excel implementation (so you understand better what I mean by cell-level)

    Yutaka Emura

    We’ve just released v22.0.901.

    – Added the Sort/Remove Duplicate split strings in Selection, Sort Columns, and Manage Columns command.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.