How to use the WPS FILTER Function

The A FILTER function in WPS Office (WPS官网下载) allows you to filter a range of data based on given criteria. It returns an array of values that match the condition(s) specified in the function. The FILTER function can be beneficial when you want to extract specific data from a larger dataset, whether for analysis or reporting purposes.
Here’s a detailed guide on how to use the FILTER Function in WPS Spreadsheets (similar to Excel):
Syntax
excel
=FILTER(array, include, [if_empty])
Parameters:
- arrayThe range or array of values you want to filter.
- includeThe condition(s) or criteria that you wish to filter the data by. This argument should evaluate to TRUE or FALSE for each row or column in the array.
- if_empty (optional)The value to return if no data matches the filter condition. If this argument is omitted and no data matches the criteria, the function will return a #CALC! error.
See also: Effective Strategies for Alleviating Tooth Pain Before Visiting a Dentist
Simple Filtering Based on a Single Condition
Let’s say you have a table of sales data like this:
Name | Sales | Date |
Alice | 500 | 01/01/2023 |
Bob | 700 | 02/01/2023 |
Charlie | 300 | 03/01/2023 |
Alice | 400 | 04/01/2023 |
Bob | 600 | 05/01/2023 |
Objective: Filter the rows where the sales are greater than 500.
Formula:
excel
=FILTER(A2:C6, B2:B6>500)
- A2:C6The data range you want to filter (columns Name, Sales, and Date).
- B2:B6>500The condition that filters the sales greater than 500.
Result:
Name | Sales | Date |
Bob | 700 | 02/01/2023 |
Bob | 600 | 05/01/2023 |
Filtering with Multiple Conditions
You can also use multiple criteria with the FILTER function by combining conditions using logical operators like * (AND) or + (OR).
Objective: Filter the rows where the sales are greater than 500 and the name is “Bob”.
Formula:
excel
=FILTER(A2:C6, (B2:B6>500)*(A2:A6=”Bob”))
- (B2:B6>500)*(A2:A6=”Bob”)This is a logical condition that combines two criteria: sales greater than 500 and the name being “Bob”. The the * operator works like an AND operator.
Result:
Name | Sales | Date |
Bob | 700 | 02/01/2023 |
Bob | 600 | 05/01/2023 |
Handling Empty Results
You can specify what to display when no data meets the criteria by using the if_empty parameter.
Objective: Filter the data for sales greater than 1000, but display a custom message if no sales meet the criteria.
Formula:
excel
=FILTER(A2:C6, B2:B6>1000, “No sales above 1000”)
- “No sales above 1000”This is the value displayed if no rows meet the criteria.
Result:
If no sales are greater than 1000 in the range, it will display:
yaml
No sales above 1000
Filter Data with Dates
Let’s say you want to filter data for sales after a specific date.
Objective: Filter all rows where the date is after 01/01/2023.
Formula:
excel
复制编辑
=FILTER(A2:C6, C2:C6>DATE(2023,1,1))
- C2:C6>DATE(2023,1,1)The condition filters all rows with a date on or after January 1, 2023.
Result:
Name | Sales | Date |
Bob | 700 | 02/01/2023 |
Alice | 400 | 04/01/2023 |
Bob | 600 | 05/01/2023 |
Advanced Usage: Nested FILTER With Other Functions
The the FILTER function can be combined with other tasks like SORT, UNIQUE, and ARRAYFORMULA to create powerful formulas.
Objective: Filter data for sales above 500 and sort them in descending order.
Formula:
excel
=SORT(FILTER(A2:C6, B2:B6>500), 2, -1)
- SORTSorts the filtered data by the second column (Sales), in descending order (-1).
Result:
Name | Sales | Date |
Bob | 700 | 02/01/2023 |
Bob | 600 | 05/01/2023 |
The FILTER Function in WPS表格 Spreadsheets is a powerful tool for data analysis, allowing you to extract specific rows based on your criteria. You can apply single or multiple conditions, handle empty results, and even combine them with other functions for more complex operations. By mastering the FILTER Function: You can streamline data processing and gain deeper insights from your datasets.