Tuesday, October 11, 2011

How to sort columns by rows in Excel and Libreoffice Calc

Excel and Openoffice/Libreoffice Calc have a function sort that will sort rows by the column you select.

In case one wants e.g. to sort the table bellow by sorting columns according to the row 1:

NHD    T2D    NHD    T2D    NHD    T2D    NHD    T2D
                          
7    3    4    7    0    14    8    5
17    12    9    14    13    10    18    13
3    0    3    3    0    2    2    0
1    0    0    0    0    0    0    1
2    0    0    0    1    0    0    0
1    1    1    3    4    2    0    0

In Libreoffice Calc:

Data/Sort
Options/Direction/Left to right (sort columns)
Sort criteria/Sort by/select the row you want

The output is sorted table:

NHD    NHD    NHD    NHD    T2D    T2D    T2D    T2D
                           
7    4    0    8    3    7    14    5
17    9    13    18    12    14    10    13
3    3    0    2    0    3    2    0
1    0    0    0    0    0    0    1
2    0    1    0    0    0    0    0
1    1    4    0    1    3    2    0

2 comments:

  1. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.

    Data Science Training in Bangalore

    ReplyDelete