PrecisionCalc
xl
Precision
Get Your Numbers Right
xlpSORT
Sorts a range of numbers, with up to 32,767 significant digits of precision.
xlpSORT must be array-entered. To array-enter an xlpSORT formula, follow these steps:
Requires the 5,000 SD edition of xlPrecision or higher, or the Free Edition.
Syntax
xlpSORT(numlist,descending,left_to_right,fit_to_array,blank_text)
numlist | Required. The range of cells with the numbers to sort. |
descending | Optional. If True, sorts from higher numbers to lower numbers. If False, sorts from lower numbers to higher numbers. False by default. |
left_to_right | Optional. Determines direction of sorting if the xlpSORT array formula is on multiple rows and columns. If True, sorts the numbers left to right. If False, numbers are sorted top to bottom. False by default. |
fit_to_array | Optional. Determines the dimensions of the sorted array of numbers if the xlpSORT array formula does not have the same dimensions as numlist. If True, sorts into the xlpSORT array formula's dimensions. If false, numlist's dimensions are retained. False by default. |
blank_text | Optional. If the xlpSORT array formula contains more cells than the number of cells in numlist, this text is used in the extra cells. Blank by default. |
Remarks
Text in numlist cells that xlPrecision can't resolve to a number, and blank cells, are sorted to the bottom. They are not sorted among themselves, but may be randomly reordered among themselves by the sorting procedure.
Numbers that are exactly equal but formatted differently (for example, one has thousands separators while the other does not) are not sorted among themselves, but may be randomly reordered among themselves by the sorting procedure.
numlist can accept cells with both numbers and text.
numlist can accept cells with text formatted with the local currency symbol and thousands separators, and negatives can be formatted with either a leading hyphen or parentheses.
Examples
Formula | Description | Result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:C5) (array-entered in A10:C14)
|
Sort the numbers in A1:C5 in ascending order, from top to bottom, and retaining the dimensions of numlist. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:C5,TRUE) (array-entered in A10:C14)
|
Sort the numbers in A1:C5 in descending order, from top to bottom, and retaining the dimensions of numlist. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:C5,,TRUE) (array-entered in A10:C14)
|
Sort the numbers in A1:C5 in ascending order, from left to right, and retaining the dimensions of numlist. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:C5,,,TRUE) (array-entered in A10:B17)
|
Sort the numbers in A1:C5 in ascending order, from top to bottom, into the xlpSORT formula's dimensions. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:C5,TRUE,TRUE,TRUE,"---") (array-entered in A10:D14)
|
Sort the numbers in A1:C5 in descending order, from left to right, into the xlpSORT formula's dimensions, and displaying "---" in the unused cells. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:C5,,,,"---") (array-entered in A10:D15)
|
Sort the numbers in A1:C5 in ascending order, from top to bottom, retaining the dimensions of numlist, and displaying "---" in the unused cells. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
=xlpSORT(A1:A17) (array-entered in A20:D36)
|
Sort the numbers in A1:C5 in ascending order, from top to bottom, and retaining the dimensions of numlist. |
|
See Also