Using The FILTER Function With One Condition
August 16, 2022 - by Bill Jelen
The new FILTER
function accepts an array, keeps the rows you specify, and returns the results to a spill range.
This example uses the following data set,
The syntax of the FILTER
function is FILTER(array, include, [if_empty])
.
Say that you want to retrieve all rows from the data set where the team is Blue. Type Blue in cell F1. The formula entered in E4 is =FILTER(A4:C16,B4:B16=F1,"None Found")
.
Notice that you don't have to use the F4 key or dollar signs in the formula. This single formula returns multiple results. There is no need to copy it anywhere, so there is no need for absolute references. Also, you do not have to press Ctrl+Shift+Enter.
If you now type Blue in F1, you get all of the Blue team members.
The optional third argument of FILTER
is illustrated here. [if_empty] specifies the text to return in case there are no results. If you change the value in F1 to Lime, you get the text specified in the formula.
You can specify an array constant as the [if_empty] argument: =FILTER(A4:C16,B4:B16=F1,{"None Found","No Team",0})
.
This article is an excerpt from Power Excel With MrExcel
Title photo by Rae Wallis on Unsplash