![](/img/trans.png)
[英]Google script - Hide/Unhide google sheet based on checkbox on another sheet
[英]Is there a Script that gives me a Filtered Table based on the words that were “checked” on checkbox - Google Sheet
我有一個數據集,我正在嘗試構建一個“搜索器”,用戶可以在其中選中不同條件的復選框,並且在選擇所有條件(可以超過 1 個)之后,它會顯示一個過濾表,其中只有數據集中出現了被檢查的標准的行。
我嘗試使用 FilterCriteria 或 Query,但似乎無法使其有效工作。 由於有 30 多個標准可供選擇,並且可以在它們之間進行混合和匹配。 例如,在第一階段(第 1 級)有 2 個標准可供選擇(應從下圖中過濾 H 列),然后有一組標准,大約 20 個(第 2 級和第 3 級),用戶可以選擇多個選項(I - N 列)。
例如,如果用戶在級別 1 中選擇選項 1,在級別 2 中選擇選項 A4,在級別 3 中選擇選項 B4,則該表應該只是第 9 行(#005,結果#5)。
試試這個公式:
=query({query({query({G5:O9},"select * where Col2 Matches "&"'"&join("|",query({$B$5:$C$5;$D$5:$E$5},"select Col2 where Col1 = true"))&"'")},"select * where Col3 Matches "&"'"&join("|",query({$B$7:$C$13;$D$7:$E$12},"select Col2 where Col1 = true"))&"' or Col4 Matches "&"'"&join("|",query({$B$7:$C$13;$D$7:$E$12},"select Col2 where Col1 = true"))&"' or Col5 Matches "&"'"&join("|",query({$B$7:$C$13;$D$7:$E$12},"select Col2 where Col1 = true"))&"'")},"select * where Col6 Matches "&"'"&join("|",query({$B$15:$C$18;$D$15:$E$18},"select Col2 where Col1 = true"))&"' or Col7 Matches "&"'"&join("|",query({$B$15:$C$18;$D$15:$E$18},"select Col2 where Col1 = true"))&"' or Col8 Matches "&"'"&join("|",query({$B$15:$C$18;$D$15:$E$18},"select Col2 where Col1 = true"))&"'")
該邏輯基於選擇匹配記錄的進程:
級別 1 (Col2),然后
每個where
語句使用:
matches
, 和join
join
公式使用查詢作為“值或數組”的輸入
query({$B$5:$C$5;$D$5:$E$5},"select Col2 where Col1 = true")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.