Filter unique distinct list sorted based on sum of adjacent values using array formula in excel
Filtering unique distinct text values and sort them based on sum of adjacent values can be done by creating a pivot table. But in this blog post I want to show how to do this, using an excel array formula.
Array formula in A11:
copied down as far as necessary.
Formula in B11:
copied down as far as necessary.
Named ranges
List_text (A2:A8)
List_number (B2:B8)
What is named ranges?
How to implement array formula to your workbook
Change the named ranges. If your list starts at, for example, F3. Change $A$10:A10 in the above formulas to F2:$F$2.
Download excel sample file for this tutorial.
Filter unique distinct list sorted based on sum of adjacent values.xls
(Excel 97-2003 Workbook *.xls)
Functions in this article:
COUNTIF(range,criteria)
Counts the number of cells within a range that meet the given condition
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
MATCH(lookup_value;lookup_array; [match_type]
Returns the relative position of an item in an array that matches a specified value
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.
ROW(reference) returns the rownumber of a reference
SUMIF(range, criteria, sum_range)
Adds the cells specified by a given condition or criteria







October 20th, 2009 at 8:29 am
[...] Filter unique distinct list sorted based on sum of adjacent values … [...]
August 24th, 2010 at 7:36 am
How might I go about doing this if the values range from positive to negative. ie.
Text Number
AA 60
BB 90
CC 80
EE -100
CC 30
FF -50
DD 100
August 25th, 2010 at 9:48 am
Eric,
Array formula in A11:
=INDEX(List_text, MATCH(LARGE(IF(COUNTIF($A$10:A10, List_text)=0, SUMIF(List_text, "="&List_text, List_number), ""), 1), SUMIF(List_text, "="&List_text, List_number)*NOT(COUNTIF($A$10:A10, List_text)), 0)) + CTRL + SHIFT + ENTER. Copy cell A11 and paste it down as far as necessary.
April 10th, 2012 at 8:36 am
What if i wanted sum value to be sorted in descending order.