Extract largest values from two columns using array formula in excel
Question: How do I extract the five largest values from two columns?
Answer:
Formula in A12:
=IF(MAX((NOT(COUNTIF(B11:$B$11, Price2)*COUNTIF(A11:$A$11, List2)>=1))*Price2)>MAX((NOT(COUNTIF(B11:$B$11, Price1)*COUNTIF(A11:$A$11, List1)>=1))*Price1), INDEX(List2, MATCH(MAX((NOT(COUNTIF(B11:$B$11, Price2)*COUNTIF(A11:$A$11, List2)>=1))*Price2), NOT(COUNTIF(B11:$B$11, Price2)*COUNTIF(A11:$A$11, List2)>=1)*Price2, 0)), INDEX(List1, MATCH(MAX((NOT(COUNTIF(B11:$B$11, Price1)*COUNTIF(A11:$A$11, List1)>=1))*Price1), NOT(COUNTIF(B11:$B$11, Price1)*COUNTIF(A11:$A$11, List1)>=1)*Price1, 0))) + CTRL + SHIFT + ENTER copied down as far as necessary
Formula in B12:
=IF(MAX((NOT(COUNTIF(B11:$B$11, Price2)*COUNTIF(A11:$A$11, List2)>=1))*Price2)>MAX((NOT(COUNTIF(B11:$B$11, Price1)*COUNTIF(A11:$A$11, List1)>=1))*Price1), INDEX(Price2, MATCH(MAX((NOT(COUNTIF(B11:$B$11, Price2)*COUNTIF(A11:$A$11, List2)>=1))*Price2), NOT(COUNTIF(B11:$B$11, Price2)*COUNTIF(A11:$A$11, List2)>=1)*Price2, 0)), INDEX(Price1, MATCH(MAX((NOT(COUNTIF(B11:$B$11, Price1)*COUNTIF(A11:$A$11, List1)>=1))*Price1), NOT(COUNTIF(B11:$B$11, Price1)*COUNTIF(A11:$A$11, List1)>=1)*Price1, 0))) + CTRL + SHIFT + ENTER copied down as far as necessary
Named ranges
List1 (A2:A6)
List2 (C2:C6)
Price1 (B2:B6)
Price2 (D2:D6)
What is named ranges?
How to implement array formula to your workbook
Change named ranges. If your list starts at, for example, cell F3 and G3. Change A11:$A$11 in the above formula to F2:$F$2 and change B11:$B$11 to G2:$G$2
Download excel example file.
extract-largest-values-from-two-columns.xls
(Excel 97-2003 Workbook *.xls)
Functions in this article
IF(logical_test,[value_if:true],[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
ROW(reference)
returns the row number of a reference
COUNTIF(range,criteria)
Counts the number of cells within a range that meet the given condition
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
MAX(number1,[number2],)
Returns the largest value in a set of values. Ignores logical values and text.
MATCH(lookup_value;lookup_array; [match_type]
Returns the relative position of an item in an array that matches a specified value
Related posts:
- How to filter values between 0.5 and 1.5 from two columns in excel 2007
- Extract a list of duplicates from two columns combined using array formula in excel
- Comparing two columns and sum unique values using array formula in excel
- Extract a list of duplicates from three columns combined using array formula in excel
- Extract a unique distinct list from two columns using excel 2007 array formula
- Filter duplicates from two columns combined and sort from A to Z using array formula in excel
- Sort text cells alphabetically from two columns using excel array formula
- Identify missing values in two columns using excel formula
- Identify largest text value in a column using array formula in excel
- Extract unique values from a range using array formula in excel




September 17th, 2009 at 6:29 pm
Hi - Thank you for putting this example on line...my question is, how do you change the formula to select the top 5 highest (loses) negitive values first.
Thank you.