none
Discussion - Sorting by Rows instead of Columns RRS feed

  • General discussion

  • This is not so much a "how to?" but more of a "why would you want to do that?"

    Say you have a report spreadsheet where the headers are down Column A rather than across Row 1. This is because there are alot of fields in this report and they won't all fit on one page for each item unless they are arranged vertically. That is the premise. So then, say you have all the data for the sheet in an array, not yet sorted by the field you want to sort it by.

    Do you?

    1. Write VBA Code to sort the array by that field, then dump it and save it as a workbook.sheet ?
    2. Write VBA Code to create an array of just the index of the original array in sorted order, and then use that to save the array to dump it to the workbook.sheet in the order you want it in, then save that ?
    3. Dump it transposed to a sheet, then sort it as a sheet, then transpose it and dump it and save it as a workbook.sheet 
    4. Some other strategy ? OR
    5. Stop creating reports that are organized sideways. Nobody does that ?

    Feel free to digress. I am just as interested in a discussion that will get me thinking different ways that a specific solution.
    Thank you.



    Thursday, October 3, 2019 11:22 PM

All replies

  • Excel has the ability to sort from left to right (or from right to left). Select Sort & Filter > Custom Sort..., then click Options...

    Warning: don't include the first column (the headers) in the selection.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, October 4, 2019 8:24 AM