Filter , Sort & Sequence Excel Functions

It’s a tremendous compounding effect when you learn excel formulas everyday. Here’s drafting the explanation about the three major excel functions with examples. You can download the excel from here for reference.

1. Filter Function:

Filter function is very handy when you want to filter the specific part of the table data. Lets see both single and multiple conditions using Filter function.

CategoryCouchesReclinersCoffee TablesEnd TablesTotal
Retail4,3104,9603,4204,51017,200
Wholesale2,3402,7502,9803,55011,620
Internet3,4204,0303,8404,38015,670
Source Data

Basic FILTER formula – Single condition

=FILTER(Sales1,Sales1[Recliners]>=3000)

CategoryCouchesReclinersCoffee TablesEnd TablesTotal
Retail431049603420451017200
Internet342040303840438015670
Single condition

Basic FILTER formula – Multiple condition

If you want to extract data based on both the two conditions, then use * . If based one either of the one condition, then use ” + ” .

=FILTER(Sales1,Sales1[Recliners]>=3000 * Sales1[Coffee Tables]>=2000)

=FILTER(Sales1,Sales1[Recliners]>=3000 + Sales1[Coffee Tables]>=2000)

CategoryCouchesReclinersCoffee TablesEnd TablesTotal
Retail431049603420451017200
Wholesale234027502980355011620
Internet342040303840438015670
Multiple condition

Filter duplicates:

If you want to extract the duplicate rows, then use countifs function. The below table is filtering all the duplicates on the field Category and Profit.

CategoryCouchesReclinersCoffee TablesEnd TablesTotalProfit
Retail4,3104,9603,4204,51017,200Yes
Wholesale2,3402,7502,9803,55011,620Yes
Internet3,4204,0303,8404,38015,670No
Internet3,4204,0303,8404,38015,670No
Wholesale1,2401,6501,8802,45010,520Yes
Wholesale2,3402,7502,9803,55011,620Yes
Wholesale2,3402,7502,9803,55011,620Yes

=FILTER(Sales2,COUNTIFS(Sales2[Category],Sales2[Category],Sales2[Profit],Sales2[Profit])>1)

Wholesale234027502980355011620Yes
Internet342040303840438015670No
Internet342040303840438015670No
Wholesale124016501880245010520Yes
Wholesale234027502980355011620Yes
Wholesale234027502980355011620Yes

2. Filter & Sort Function:

You can extract the data using filter function and sort the data as well. To do so, lets take a table as below.

ItemQty.
Apples38
Cherries29
Grapes31
Lemons34
Melon26
Oranges36
Peaches25
Pears40

SORT(FILTER(array, criteria_range=criteria), [sort_index], [sort_order], [by_col])

The important thing to notice in this formula is that you do not need to press Ctrl + Shift + Enter to convert it as an Array. Just type a formula in the upper most cell and hit the Enter key.

Sort Index -Depicts the column number which you want to sort.

Sort Order – You can sort the data either ascending or descending order. By default it will be sorted by ascending order.

=SORT(FILTER(A2:B9, B2:B9>=30), 2)

ItemQty.
Grapes31
Lemons34
Oranges36
Apples38
Pears40
Table filtered and sorted

3. Index, Sort & Sequence Function:

When analyzing huge amount of information, you need to extract a certain number of top values. With dynamic array functions, you can easily sort and also display Top N or Bottom N values.

INDEX(SORT(…), SEQUENCE(n), {column1_to_return, column2_to_return, …})

RegionItemQty.
EastLemons36
EastGrapes31
NorthCherries29
NorthGrapes27
NorthPeaches25
SouthPears40
SouthApples38
SouthOranges36
SouthCherries28
WestLemons34
WestApples30
WestOranges29

=INDEX(SORT(A2:C13,3,-1),SEQUENCE(3),{2,3})

In the above formula,

  • A2:C13 – denotes the data set
  • 3 – denotes the column Qty
  • -1 – denotes the descending order
  • Sequence function (3) – displays the top 3 values
  • {2,3} – returns the column Items and Qty.
ItemQty.
Pears40
Apples38
Lemons36
Final Output

Hope you find it useful. Catch you in the next post.


Discover more from LR Virtual Classroom

Subscribe to get the latest posts sent to your email.

Published by Lashmi Bai Ravindrapandian

V Shaped Functional PMO Professional | Helping Org to execute their Programs | Learning Evangelist | Strategic & Digital Mindset | Agilist | Manager at Mind & Leader at Heart