There is no built-in formula that lets you evaluate a custom string as formula.
In your use, B:B<=0
is not a string. It is actually evaluated into a (local) array of true
/false
.
If you want to change your formula based on the text of a cell with Apps Script, you can reference this question
That said, it seems as if you want to make a dropdown menu to toggle between two different analysis you are doing to your data set.
I can outline some steps to achieve the effect below:
Create 2 sets of arrays in helper columns. One set is B:B<=0
; another is B:B>=0
Use indirect()
to access that range by referencing a cell and use that as the input in filter()
.
Make a dropdown menu for that cell using the Data -> Data validation UI.
However, storing B:B<=0
is cumbersome. And thus it is not generally advisable.