SORT

    Lookup & Reference

    Sorts the contents of a range or array. Returns a dynamic array with sorted results.

    Translations
    EnglishSORT
    FrenchTRIER
    SpanishORDENAR
    GermanSORTIEREN
    ItalianORDINA
    PortugueseCLASSIFICAR
    DutchSORTEREN
    PolishSORTUJ
    RussianСОРТ
    TurkishSIRALA
    CzechSORT
    HungarianRENDEZÉS
    SwedishSORTERA
    DanishSORTER
    FinnishLAJITTELE
    Syntax
    SORT(array, [sort_index], [sort_order], [by_col])

    Arguments

    • arrayThe range to sort
    • sort_indexColumn or row number to sort by(optional)
    • sort_order1 for ascending, -1 for descending(optional)
    • by_colTRUE to sort by column instead of row(optional)
    Examples
    =SORT(A1:C10)
    Sorted by first column

    Sorts ascending by column A

    =SORT(A1:C10,2,-1)
    Sorted by column 2 desc

    Sorts descending by column B

    =SORT(FILTER(A:C,B:B>100),3,-1)
    Filtered and sorted

    Combines FILTER and SORT

    Tips & Best Practices
    • Returns a dynamic spilling array
    • Can sort by multiple columns with nested SORT
    • Use SORTBY for more complex sorting
    Common Mistakes
    • Forgetting that SORT returns a spilled array, so any content sitting in the cells below or beside the formula blocks the spill and triggers a #SPILL! error
    • Mixing up the sort_index argument with an absolute column letter - sort_index refers to the column's position within the array being sorted, not its position in the worksheet
    • Assuming SORT updates the original data - it only reorders the spilled output, leaving the source range completely untouched
    Related Functions
    SORTBYSorts an array by a separate corresponding array, rather than by a column index within the same array like SORT.
    FILTEROften combined with SORT to narrow and then reorder a dataset in the same formula.
    RANKAssigns a rank to individual values rather than reordering an entire array.
    Frequently Asked Questions

    Why does SORT show a #SPILL! error?

    Something occupies one of the cells where the sorted results need to spill into. Clear the surrounding cells and the formula will display correctly.

    Does SORT change my original data?

    No, it only creates a new, reordered spilled array in the formula's output cells - the source data stays exactly as it was.

    What does the sort_index argument actually refer to?

    It's the column position within the array you're sorting, counting from 1 - not the worksheet's column letter.

    Need to translate a formula using SORT?

    Use our translator to convert your complete formula