The information in this article applies to:
SUMMARYBy using a special adaptation of the MIN() function as an array, you can create a list sorted in ascending order that will re-sort each time the Microsoft Excel worksheet is recalculated. This formula is useful in cases where the original unsorted data may frequently change. MORE INFORMATION
To simplify the discussion of this technique, an assumption is made here
that the data to be sorted is in a single column and the sorted version of
this data will be located in an adjacent column and sorted in ascending
order.
Example for versions 3.0, 4.0, 5.0
If you change the value in cell A2 from 7 to 96, the sorted values in column B will reflect this change. NOTE: If the Calculation option for your worksheet is set to Manual, you will need to calculate the worksheet to see this change. This kind of dynamic sort can also be performed in descending order. To do this, use the MAX() function in place of all MIN() functions, use a less than operator (<) in place of the first greater than operator (>), and change the single MAX() function to MIN(), as in the following example:
This formula can be simplified by leaving out the entire second argument to the IF() statement (in either the MAX() or MIN() case). However, this simplification will produce an incorrect sort if there are any duplicates in the original data set. Example for Microsoft Excel 4.0 and laterIn Microsoft Excel version 4.0and greater, you can use the SMALL() and LARGE() functions. For example, SMALL($A$1:$A$5,1) returns the smallest value in the range and LARGE($A$1:$A$5,1) returns the largest value in the range. To produce a sorted list, you can use the following function:
where $A$1:$A$8 is the range that contains your numbers to be sorted and assumes that your formula starts in row 1. If your formula does not start in row 1, but rather in row 5, change the formula to read:
Another alternative is to create another column with the numbers 1 through the maximum number of entries in the range to be sorted. For example, if you have created the numbered list starting in cell B1, you can refer to these values in the formula
where B1 is 1, B2 is 2, B3 is 3, and so on. REFERENCES
"User's Guide 1," version 4.0, pages 134-137, 157-166 Additional query words: 2.00 2.01 2.10 2.20 2.21 resort
Keywords : |
Last Reviewed: March 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |