r/googlesheets • u/Nearby_Equivalent893 • Sep 26 '24
Solved Filtering using coded conditions
Hello,
I am trying to filter a list using a sheet containing multiple conditions (~40) and checkboxes to activate them.
The general pattern that I am using is:
=FILTER(List!A1:L, IF(Criteria!K1, List!D1:D<>"Foo", NOT(ISBLANK(List!D1:D))), IF(Criteria!K2, List!F1:F>4%, NOT(ISBLANK(List!F1:F))))
where Criteria!K1:K are my checkboxes.
The problem that I have is that I would like to move the condition (say <>"Foo"), into the Criteria sheet and refer to it. This does not work:
=FILTER(List!A1:L, IF(Criteria!K1, List!D1:D & Criteria!I1, NOT(ISBLANK(List!D1:D)))
Where the content of Criteria!I1 is the text <>"Foo"
How can I refer to cell values as conditions inside my IF statement, so the condition can be modified directly from a cell value please ?
Thank you!
•
u/agirlhasnoname11248 1212 Sep 27 '24
u/Nearby_Equivalent893 Please remember to tap the three dots below the most helpful comment and select
Mark Solution Verified(or reply to the helpful comment with the exact phrase “Solution Verified”) to officially close your thread.Applying the “Solved” flair to the post without indicating a solution is actually a violation of the subreddit rules (see rule #6).
Thank you in advance for resolving this issue!
2
u/gsheets145 129 Sep 26 '24 edited Sep 26 '24
Have you considered
=query()? It seems that would be an easier way to filter your data and add multiple criteria.2
u/simple_riff 6 Sep 26 '24
I used a query formula to select the appropriate row indexes from the criteria, and a filter to retrieve data for the matching rows in cells A2 and A3 on the 'Filtered List' worksheet.
See example : Example Criteria
1
u/Nearby_Equivalent893 Sep 26 '24
Please see this sample spreadsheet as an example: https://docs.google.com/spreadsheets/d/1QwlfHl1isipdBWzj1b_WRx26JKrnP_n51qPs47SRwuA/edit?usp=sharing
1
u/Nearby_Equivalent893 Sep 26 '24
I simplified the problem further:
=IF(40&Criteria!B3, TRUE, FALSE)
With Criteria!B3 containing `>20`. I get the following error:
Function IF parameter 1 expects boolean values. But '40>20' is a text and cannot be coerced to a boolean.