Resources

How to use multiple criteria in the FILTER function

Ever wanted to return a subset of a dataset rather than the whole thing? The FILTER function lets us sieve a table to extract only the desired rows based on criteria.

Check out this quick video to learn how to do this!

@globalexcelsummit The FILTER function lets us sieve a table to extract only the desired rows based on criteria. In the video example, a table called tblProducts houses product data, and we want to return only the items that cost under Β£100. This formula achieves the result: =π™΅π™Έπ™»πšƒπ™΄πš(πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ, πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ[π™Ώπš›πš’πšŒπšŽ (Β£)]<𝟷00 ) The table name is referenced in πšŠπš›πš›πšŠπš’ to return all columns, whilst the condition is specified in πš’πš—πšŒπš•πšžπšπšŽ to return all rows where the value in the Price column is less than 100. The condition evaluates to an array of TRUE and FALSE values that represent the rows and indicate which ones to return: {πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄} Often, you're likely to require more than one criterion, though. The function provides no obvious way of doing this. However, there is a way: =π™΅π™Έπ™»πšƒπ™΄πš(πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ, (πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ[π™Ώπš›πš’πšŒπšŽ (Β£)]<𝟷00) * (πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ[πšπšŠπšπš’πš—πš]>=𝟺) ) Building on the same condition as the first example, an asterisk is added after, which is the multiplication operator representing AND criteria. The second condition then returns all rows with a value greater than or equal to 4 in the Rating column. This calculation is taking place: {𝟷;0;𝟷;𝟷;0;0;𝟷;𝟷;0;𝟷;𝟷;0;0;0;0;0;0;0;𝟷;𝟷} * {0;𝟷;𝟷;0;𝟷;0;0;𝟷;0;0;0;𝟷;0;0;0;𝟷;0;𝟷;𝟷;0} Because two conditions are multiplied, the TRUE and FALSE array values are coerced into 1s and 0s. Multiplying by 0 is always 0, so both respective values must equal 1 for their row to be returned. Finally, if using multiple conditions, be sure to enclose each one in brackets to avoid any unusual results. #excelerationΒ #excelΒ #globalexcelsummit ♬ original sound - globalexcelsummit

In the example, a table called tblProducts houses product data, and we want to return only the items that cost under Β£100.

This formula achieves the result:

=π™΅π™Έπ™»πšƒπ™΄πš(πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ,
πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ[π™Ώπš›πš’πšŒπšŽ (Β£)]<𝟷00
)

The table name is referenced in πšŠπš›πš›πšŠπš’ to return all columns, whilst the condition is specified in πš’πš—πšŒπš•πšžπšπšŽ to return all rows where the value in the Price column is less than 100.

The condition evaluates to an array of TRUE and FALSE values that represent the rows and indicate which ones to return:

{πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;
πšƒπšπš„π™΄;πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;
π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;π™΅π™°π™»πš‚π™΄;πšƒπšπš„π™΄;πšƒπšπš„π™΄}

Often, you're likely to require more than one criterion, though. The function provides no obvious way of doing this. However, there is a way:

=π™΅π™Έπ™»πšƒπ™΄πš(πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ,(πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ[π™Ώπš›πš’πšŒπšŽ (Β£)]<𝟷00)*(πšπš‹πš•π™Ώπš›πš˜πšπšžπšŒπšπšœ[πšπšŠπšπš’πš—πš]>=𝟺))

Building on the same condition as the first example, an asterisk is added after, which is the multiplication operator representing AND criteria. The second condition then returns all rows with a value greater than or equal to 4 in the Rating column.

This calculation is taking place:

{𝟷;0;𝟷;𝟷;0;0;𝟷;𝟷;0;𝟷;𝟷;0;0;0;0;0;0;0;𝟷;𝟷}
*
{0;𝟷;𝟷;0;𝟷;0;0;𝟷;0;0;0;𝟷;0;0;0;𝟷;0;𝟷;𝟷;0}

Because two conditions are multiplied, the TRUE and FALSE array values are coerced into 1s and 0s. Multiplying by 0 is always 0, so both respective values must equal 1 for their row to be returned.

Finally, if using multiple conditions, be sure to enclose each one in brackets to avoid any unusual results.

Like this guide? Check out our Video Tutorials to discover other ways to power up your Excel skills!

Andrew Moss
About the Author

Andrew Moss

Andrew is a technical writer who specialises in Microsoft Excel and data analysis. He has published hundreds of articles and social media posts aimed at helping people enhance their skills and spreading good practices.

Conversation

0 Comments

As you comment, let's keep the discussion friendly and respectful to add value to the conversation.

Thank you! Your comment has been sent!
Oops! Something went wrong while submitting the form.
Commenter profile pic.
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Reply
Delete
Commenter profile pic.
Author Name
Comment Time

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere. uis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Reply
Delete

Get Tickets

Benefit from an award-winning 3-day conference plus access to exclusive networking and additional Masterclass events.

Get Tickets
Close Cookie Popup
Cookie Preferences
By clicking β€œAccept All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage and assist in our marketing efforts as outlined in our privacy policy.
Strictly Necessary (Always Active)
Cookies required to enable basic website functionality.
Cookies helping us understand how this website performs, how visitors interact with the site, and whether there may be technical issues.
Cookies used to deliver advertising that is more relevant to you and your interests.
Cookies allowing the website to remember choices you make (such as your user name, language, or the region you are in).