File: func_sort.xhp

package info (click to toggle)
libreoffice 4%3A25.2.3-2%2Bdeb13u2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,785,556 kB
  • sloc: cpp: 4,354,935; xml: 450,154; java: 260,044; python: 80,206; ansic: 33,790; perl: 30,351; javascript: 18,236; sh: 12,043; makefile: 10,672; cs: 8,865; yacc: 8,549; objc: 2,131; lex: 1,379; asm: 1,231; awk: 996; pascal: 940; csh: 20; sed: 5
file content (167 lines) | stat: -rw-r--r-- 7,524 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">
    <!--
    * This file is part of the LibreOffice project.
    *
    * This Source Code Form is subject to the terms of the Mozilla Public
    * License, v. 2.0. If a copy of the MPL was not distributed with this
    * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    *
    -->

<meta>
    <topic id="textscalc01func_sortxhp" indexer="include" status="PUBLISH">
    <title id="tit">SORT function</title>
    <filename>/text/scalc/01/func_sort.xhp</filename>
    </topic>
</meta>
<body>
<bookmark id="bm_id221708806478124" branch="hid/SC_HID_FUNC_SORT_MS" localize="false"/>
<bookmark branch="index" id="bm_id361708283183878">
<bookmark_value>SORT function</bookmark_value>
</bookmark>
<section id="sort">
    <h1 id="hd_id901708806478126"><variable id="h1"><link href="text/scalc/01/func_sort.xhp">SORT</link></variable></h1>
    <paragraph id="par_id771708806478128" role="paragraph">Sorts the contents of a range or array.</paragraph>
</section>
<note id="par_id131711543270539">Enter the formula as an <link href="text/scalc/01/04060107.xhp">array formula</link>.</note>
<embed href="text/scalc/01/ful_func.xhp#func_head_syntax"/>
<paragraph role="code" id="par_id211708281649651">SORT(Range [; SortIndex [; SortOrder [; ByCol] ] ])</paragraph>
<paragraph role="paragraph" id="par_id551711457515235"><emph>Range:</emph> the range or array to sort.</paragraph>
<paragraph role="paragraph" id="par_id151711457520290"><emph>SortIndex:</emph> (optional). The number indicating the row or column to sort by.</paragraph>
<paragraph role="paragraph" id="par_id131711457525811"><emph>SortOrder:</emph> (optional). A number indicating the desired sort order; 1 for ascending order (default), -1 for descending order.</paragraph>
<paragraph role="paragraph" id="par_id351711457531579"><emph>ByCol:</emph> (optional). A logical value indicating the desired sort direction; <emph>FALSE</emph> to sort by row (default), <emph>TRUE</emph> to sort by column.</paragraph>
<embed href="text/scalc/01/common_func.xhp#optional_args"/>
<embed href="text/scalc/01/ful_func.xhp#func_head_example"/>
<embed href="text/scalc/01/ex_data_stat_func.xhp#ex_func_average_table"/>
<h4 id="hd_id751711480783220">Example with ascending order</h4>
<paragraph role="paragraph" id="par_id131711466000482"><input>{=SORT(A2:C6;2;1)}</input> </paragraph>
<paragraph role="paragraph" id="par_id471711472262161">Sort the range A2:C6 based on the second column in ascending order (Sales).</paragraph>
<table id="result01">
    <tablerow>
    <tablecell>
        <paragraph id="par_id31711465709083" role="tablecontent">book</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id151711465709084" localize="false" role="tablecontent">17</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id861711465709085" localize="false" role="tablecontent">180</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id861711465758906" role="tablecontent">pencil</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id971711465758907" localize="false" role="tablecontent">20</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id831711465758908" localize="false" role="tablecontent">65</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id331711465788257" role="tablecontent">notebook</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id531711465788258" localize="false" role="tablecontent">20</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id641711465788260" localize="false" role="tablecontent">190</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id821711465827777" role="tablecontent">pen</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id141711465827778" localize="false" role="tablecontent">35</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id431711465827779" localize="false" role="tablecontent">85</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id11711465871342" role="tablecontent">pencil-case</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id771711465871343" localize="false" role="tablecontent">not</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id911711465871344" localize="false" role="tablecontent">not</paragraph>
    </tablecell>
</tablerow>
</table>
<h4 id="hd_id51711480751179">Example with descending order</h4>
<paragraph role="paragraph" id="par_id731711466320553"><input>{=SORT(A2:C6;3;-1)}</input> </paragraph>
<paragraph role="paragraph" id="par_id401711479167509">Sort the range A2:C6 based on the third column in descending order (Revenue).</paragraph>
<table id="result02">
    <tablerow>
    <tablecell>
        <paragraph id="par_id821711478931934" role="tablecontent">pencil-case</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id401711478935550" localize="false" role="tablecontent">not</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id551711478938510" localize="false" role="tablecontent">not</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id721711478941598" role="tablecontent">notebook</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id601711478944454" localize="false" role="tablecontent">20</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id451711478947461" localize="false" role="tablecontent">190</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id281711478950341" role="tablecontent">book</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id381711478953613" localize="false" role="tablecontent">17</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id731711478956157" localize="false" role="tablecontent">180</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id101711478960309" role="tablecontent">pen</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id681711478963398" localize="false" role="tablecontent">35</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id671711478966117" localize="false" role="tablecontent">85</paragraph>
    </tablecell>
</tablerow>
<tablerow>
    <tablecell>
        <paragraph id="par_id911711478969701" role="tablecontent">pencil</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id151711478972741" localize="false" role="tablecontent">20</paragraph>
    </tablecell>
    <tablecell>
        <paragraph id="par_id451711478975756" localize="false" role="tablecontent">65</paragraph>
    </tablecell>
</tablerow>
</table>

<embed href="text/scalc/01/common_func.xhp#sectiontechinfo"/>
<embed href="text/scalc/00/avail_release.xhp#24.8"/>
<embed href="text/scalc/01/common_func.xhp#notODFF"/>
<paragraph role="paragraph" id="par_id341640870986703" localize="false"><literal>COM.MICROSOFT.SORT</literal></paragraph>
<section id="relatedtopics">
    <tip id="par_id701677016751508"><link href="https://wiki.documentfoundation.org/Documentation/Calc_Functions/SORT">SORT wiki page</link>.</tip>
    <embed href="text/scalc/01/func_sortby.xhp#h1"/>
</section>
</body>
</helpdocument>