![]() |
| サイトマップ | |
|
範囲として与えられた数値を昇順に並び替えます。または、範囲として与えられた数値をデータのブロックとともに昇順で並べ替えます。
sort
(block, range)
引数 range には 1つの範囲 ({} で指定) 、もしくは、ワークシートの1列を指定します。引数 block を省略すると、引数 range のデータが昇順で並べられます。
col(2) = sort(col(1))
は、列1に含まれる要素を昇順に並べ替えて、列2に配置します。降順に並べ替えるには、以下のようにカスタム関数:reverse(x) = x[data(size(x),1)]を定義し、並べ替えた結果に適用します。例えば、
reverse(sort(x))
は範囲 x を降順に並べ替えます。block(3,1) = sort(block(1,1,2,size(col(2))),col(2))では、列2をキー列として列1と2を並べ替え、結果を列 3 と 4 に返します。
This function can be used to sort a range of numbers in ascending order, or a range of numbers in ascending order together with a block of data.
sort(block,range)
The range argument can be either a specified range (indicated with the { } brackets) or a worksheet column. If the block argument is omitted, the data in range is sorted in ascending order.
reverse(x) = x[data(size(x),1)]then apply it to the results of the sort. For example, reverse(sort(x)) sorts range x in descending order.
block(3,1) = sort(block(1,1,2,size(col(2))),col(2))sorts data in columns 1 and 2 using column 2 as the key column and places the sorted data in columns 3 and 4.