Your question is very generic, I will try provide here some guidelines on how to achieve it in Excel or Google Sheet based on my own experience. The approach used for Excel can be used for Google Spreadsheet, since it is based on FILTER
function that both tools have but with different signature. For Google Spreadsheet you can also use QUERY
that is very powerful for situation like this.
In all cases, it is a good practice to have a sheet with the input raw data (let's say Input
tab), then in second sheet the working data of filtered data (let's say WorkData
). This is specially relevant when the raw data is big dataset, so you don't touch the original data set, and instead you have the filtered data in a separated tab.
Both tools offer filter features in the UI or slice. This is something to consider, but using Excel/Google Spreadsheet functions, you can show the filter parameters in a more friendly manner, because you can see the parameters selected without additional click to find what filter values where selected. The approach here is based on Excel/Google Spreadsheet functions.
Excel
Let's say you have a block of filter conditions that you want to apply to a range of data. You can use data validation list so you can select a subset of possible values for each of the filter conditions and then to concatenate such conditions logically (OR
or AND
) using multiplication of addition.
=FILTER(dataset, condition1 * condition2...conditionN)
where each condition is based on the filter value you want to restrict and each condition represents an array of {TRUE,FALSE}
values all of them of the same size as dataset
(number of rows).
I use some wildcard values to represent all values of the column, in my case I use ALL
, but you can setup in a different way. In such case the filter doesn't take effect, but we want to make it work when a specific value is selected. The following trick can be used for both scenarios.
IF(B3="ALL", D3:D15<>"*",D3:D15=B3)
indicating that if B3
is equal to ALL
, then the condition to select all of the D3:D15
rows is the following: <>"*"
. Otherwise select only the rows equals to B3
.
Sometimes I would like to consider OR conditions for a given filter condition, for example for a given filter condition, consider value1
or value2
and it is represented in the filter value as a list of values delimited by comma, for example: value1, value2
.
Here, some Stack Overflow questions I posted with answers about how to deal with that:
- Filter an excel range based on multiple dynamic filter conditions
- Filter an excel range based on multiple dynamic filter conditions (with column values delimited)
Google Spreadsheet
The FILTER
function here, allows to add the filter conditions via input arguments, so now we have:
=FILTER(dataset, condition1, condition2...,conditionN)
Note: Keep in mind in Google Spreadsheet we don't need to add the conditions by multiplying each one of them. It is added via input argument.
here you can check some of question I posted related to this topic:
- Using ARRAYFORMULA with SUMIF for multiple conditions combined with a wildcard to select all values for a given condition
- Using ARRAYFORMULA with SUMIF for multiple conditions combined with conditions using a wildcard. Result by Months
In some cases it is better to use QUERY
function.
Here, a sample file using QUERY
statement and how to combine multiple conditions inserting IF
in the where
statement.
sample query on C1
cell:
=query('Jira Issues'!$A:$T, "where "
& IF(B2="", "G is not Null", "G >= date '"
& TEXT(startPeriod,"yyyy-mm-dd")&"'")
& IF(B3="", "", " and G <= date '"
& TEXT(endPeriod,"yyyy-mm-dd")&"'")
& IF(OR(B4="ALL",B4=""), "", " and A='"&B4&"'")
& IF(OR(B5="ALL",B5=""), "", " and I='"&B5&"'")
& " label A 'Team', S 'Reporter', T 'Assignee',
P 'Env.', I 'Release'",1)

The raw data is in Jira Issues
tab, the data populated is based on multiple filter conditions. I am using some name ranges for the filter values for a better understanding of the formula, such as: startPeriod
, endPeriod
, etc. You can test the actual query will be invoked looking at the result of the consolidated string of the query
input argument of QUERY
function.
Similarly you can stablish a where
statement to consider whether the input parameter is empty or not. In such case, you can build a logic like this inserting an IF
block as part of the where
statement and concatenate the string result.
=QUERY(Input!A:Y,
"select *" & " where A " & IF(B2="", "<>'*'", "='"&B2&"'")
"and " & " where B " & IF(B3="", "<>'*'", "='"&B3&"'")
,1)
The above query for column A
or B
, returns the entire column via condition: "<>'*'"
if the input parameter B2
or B3
were not specified. In a similar way you can add additional conditions for more parameters, repeating the third line of the query and changing the column and the parameter cell.
Recommendations
- Focus on a specific tool: Excel or Google Spreadsheet, even they have some similarities, you need to get familiar with the specifics of each one of them.
- Try to start working on your specific problem, once you face impediments, do some research, usually you are not the first person facing this problem, if you don't find a solution, then post your specific problem using a sample as an extract of your real problem (in English, your sample is in other language). Generic questions like this one are difficult to get some attention.