SORT

Sorts the contents of a range or array.

note

Enter the formula as an array formula.


Syntaks

SORT(Range [, SortIndex[, SortOrder[, ByCol]]])

Range: Required. The range or array to sort.

SortIndex: Optional. The number indicating the row or column to sort by.

SortOrder: Optional. A number indicating the desired sort order; 1 for ascending order (default), -1 for descending order.

ByCol: Optional. A logical value indicating the desired sort direction; FALSE to sort by row (default), TRUE to sort by column.

note

Any of the optional arguments can be omitted. An optional argument is required to be preceded by the preceding separators.


Eksempler

Betragt den følgende tabel

A

B

C

1

Produktnavn

Sales

Revenue

2

blyant

20

65

3

kuglepen

35

85

4

notesblok

20

190

5

bog

17

180

6

pencil-case

not

not


Example with ascending order

{=SORT(A2:C6,2,1)}

Sort the range A2:C6 based on the second column in ascending order (Sales).

book

17

180

pencil

20

65

notebook

20

190

pen

35

85

pencil-case

not

not


Example with descending order

{=SORT(A2:C6,3,-1)}

Sort the range A2:C6 based on the third column in descending order (Revenue).

pencil-case

not

not

notebook

20

190

book

17

180

pen

35

85

pencil

20

65


Tekniske oplysninger

tip

This function is available since LibreOfficeDev 24.8.


Denne funktion er ikke en del af standarden Open Document Format for kontorprogrammer (OpenDocument) Version 1.3. del 4: Omregnet formel (OpenFormula) -format. Navnerummet er

COM.MICROSOFT.SORT