how to arrange in ascending order



  • Hi, guys. I have a doubt: there is how to arrange in increasing order the months and years?
    https://1drv.ms/i/s!AjClnevQ_1BJg7ly2EvPzDLZ00GTQQ

    Thankssss



  • Edit > Line Operations > Sort Lines As Integers Ascending



  • Hello Neto Bezerra and Binnu Jesudasan Gudapati,

    Binnu, I don’t think that’s exactly the sorted list of dates that would like Neto ! Indeed, from the original example list of dates, below :

    11/2011
    04/2013
    08/2012
    01/2011
    05/2014
    03/2013
    10/2012
    

    if we perform the sort Edit > Line Operations > Sort Lines As Integers Ascending, we obtain :

    01/2011
    03/2013
    04/2013
    05/2014
    08/2012
    10/2012
    11/2011
    

    It’s easy that this list is not sorted by year :-(( But you can easily sort a list of dates, if your remember one important rule :

    Write the different items of the date, from left to right, from the less frequently changed item to the more frequently changed item

    In our case, as years changed less frequently than months, we must re-organize the list, according to the template year/month. To do so, just use the following S/R, in Regular expression mode :

    SEARCH : (\d+)/(\d+)

    REPLACE : \2/\1 or $2/$1

    Therefore, from the original example, above, we get, after the S/R, the new list :

    2011/11
    2013/04
    2012/08
    2011/01
    2014/05
    2013/03
    2012/10
    

    Finally, we perform the classical sort Edit > Line Operations > Sort Lines Lexicographically Ascending, to obtain the well-sorted list ( to my mind ! ), below :

    2011/01
    2011/11
    2012/08
    2012/10
    2013/03
    2013/04
    2014/05
    

    Best Regards,

    guy038



  • Perhaps the OP needs the data to be in the
    MM/YYYY
    format after the sort.

    Simply performing again guy038’s regex search and replace will do that.



  • Hi Scott,

    Oh yes ! I forgot that final point ! Thanks for your reply !

    guy038



  • Thanks so much, guys!!!



  • Guys, there is a possibility to put some kind of marking or space for when happening a break in the sequence?
    Example:

    2011/03
    2011/04
    2011/05

    2011/07
    2011/08

    2012/01
    2012/02

    Thank you very much in advance!!



  • You need to do some programming in order to achieve that.


Log in to reply