How to sort Excel columns when columms have titles?


  1. Posts : 184
    Windows 10
       #1

    How to sort Excel columns when columms have titles?


    In Excel 2016, I have column titles that appear at the top of every page below the header. When I sort the file the titles seem to be treated as data and get sorted together.

    How can I prevent this from happening?
      My Computer


  2. Posts : 43,158
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, if it's anything like Libre Office (sorry, no longer have Excel) you might click the Sort button (rather than Sort ascending etc) then look for an option like
    Headers - Range contains column labels.

    Check that and you should find the sort ignores the header field.
    How to sort Excel columns when columms have titles?-1.jpg
      My Computers


  3. Posts : 16,996
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #3

    stanhilliard said:
    In Excel 2016, I have column titles that appear at the top of every page below the header. When I sort the file the titles seem to be treated as data and get sorted together.
    How can I prevent this from happening?
    You can prevent this by using AutoFilters [see Excel Help]
    - Select all your top-row cells, all your headers
    - At the right hand end of the Home tab, click on Sort & filter and then select Filter from the dropdown list that appears.
    How to sort Excel columns when columms have titles?-select-autofilter.png
    When you do a sort, Excel will now know that the headers are headers that are not to be sorted with the data.

    And
    - the filter symbol will be shown in the header cell of each column and provides access to very useful filtering & sorting options.
    - if you ever want to do an unusual sort, click on Sort & filter again and choose Custom sort to bring up a dialog that offers a lot of choices.


    Denis
    Last edited by Try3; 2 Weeks Ago at 08:22.
      My Computer


  4. Posts : 14,049
    Win10 Pro and Home, Win11 Pro and Home, Win7, Linux Mint
       #4

    stanhilliard said:
    In Excel 2016, I have column titles that appear at the top of every page below the header. When I sort the file the titles seem to be treated as data and get sorted together.

    How can I prevent this from happening?
    It's been a long time, couple decades [Lotus 1-2-3], since I saw that happen and it was because the user had created the column headings in Row 1 but didn't lock the cells and they were indeed treated as data.
      My Computers


  5. Posts : 184
    Windows 10
    Thread Starter
       #5

    I failed to describ my situation above sufficiently. I have 4 pages when printed. I have made the top row of each page a column heading for the purpose of reading the printed report. I want to sort the rows of the sheet based on a selected column - as if the column headings were not there.
      My Computer


  6. Posts : 16,996
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #6

    Stan,

    stanhilliard said:
    I want to sort the rows of the sheet based on a selected column - as if the column headings were not there.
    And that is what my post #3 explains.


    stanhilliard said:
    I failed to describ my situation above sufficiently. I have 4 pages when printed. I have made the top row of each page a column heading for the purpose of reading the printed report.
    What you set up for a printed page has no effect on sorting the spreadsheet.


    Denis
      My Computer


  7. Posts : 184
    Windows 10
    Thread Starter
       #7

    The top row of each of the 4 pages is real sheet-row of column titles that I typed in. The title rows are not created during printing. I would prefer that the titles be there only when the sheet is printed, but I don't know how to do that. My new question is how can I make the printed pages contain the column titles at the top of each page -- without them being in the sheet?
      My Computer


  8. Posts : 16,996
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #8

    If you inserted rows into the body of your spreadsheet containing column titles then Excel has no way of knowing they have any special status and will treat them as data like any other row.
    The only exception is a row containing AutoFilters [described above].


    I know almost nothing about printing Excel spreadsheets.
    But do search Excel Help for Print row and column headings on a worksheet.
    How to sort Excel columns when columms have titles?-excel-2021-help-print-row-column-headings-worksheet.png
    I think this is the best result - Page setup - MSSupport and I've explained the key point below.

    If you are doing this just for their appearance on the printed page, which is what I think you want to do, then I suggest you delete those inserted rows and use the Titles facility or Header-Footer facility of Excel printing.
    I think the Titles facility is the one you want. It will allow you to do whatever sorting you want in the spreadsheet and display column headers on every printed page.


    Titles facility
    Excel,
    Page layout tab,
    Page setup section,
    Print titles,
    Sheet tab,
    Rows to repeat at top.
    You can, for example, tell it to repeat your very top row which is the one you have already written headers in when you set up AutoFilters.
    How to sort Excel columns when columms have titles?-excel-page-layout-tab-page-setup-section-print-titles-sheet-tab.png


    Header-Footer facility
    Excel,
    Page layout tab,
    Page setup section,
    Print titles,
    Header/Footer tab,
    Header
    or
    Custom header.
    How to sort Excel columns when columms have titles?-excel-page-layout-tab-page-setup-section-print-titles-header-footer-tab-header-custom-he.png
    If your Header dropdown list does not have what you want then you can put whatever you want in Custom headers.



    Denis
    Last edited by Try3; 1 Week Ago at 01:25.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:54.
Find Us




Windows 10 Forums