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:
=INDEX(List_text, MATCH(MAX(SUMIF(List_text, "="&List_text, List_number)*NOT(COUNTIF($A$10:A10, List_text))), SUMIF(List_text, "="&List_text, List_number)*NOT(COUNTIF($A$10:A10, List_text)), 0)) + CTRL + SHIFT + ENTER copied down as far as necessary.
Formula in B11:
=SUMIF(List_text, A11, List_number) + ENTER 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
Related posts:
- Create unique distinct list sorted based on text length using array formula in excel
- Filter a column and create a new unique list sorted from A to Z using array formula in excel
- Unique distinct list sorted based on occurrance in a column in excel
- Filter unique distinct text values using “begins with” criterion in a range using array formula in excel
- Unique distinct list from a column sorted A to Z using array formula in excel
- Filter unique distinct values where adjacent cells contain search string in excel
- Filter unique values from a range using array formula in excel
- Filter text values existing in range 1 but not in range 2 using array formula in excel
- Filter common text values in range 1 and in range 2 using array formula in excel
- Extract unique values from a range using array formula in excel



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.