Filter and logical operators - google-sheets

EZ stuff but after an hour.. =filter(May15!A:S , May15!E:E="Authorization") is yielding a rich populated sheet. However I can't get OR working! Despite it working elsewhere in the sheet. I'd like other possibilities via the same filter. I tried several including the OR this way
=filter(May15!A:S , OR(May15!E:E="Authorization" , May15!E:E="bigwhale", May15!E:E="hi"))
.. to no avail. Any help appreciated. Also, I read somewhere the OR could be accessed using a "+" and that sounded like a neat method.. Thanks!

One possible way is to use RegEx:
=filter(H:H , REGEXMATCH(E:E,JOIN("|",A1:A3)))
put in A1:A3:
Authorization
bigwhale
hi
This trick is useful when you need to add conditions, just paste one more value in cell A4 and use range A1:A4
Another way is to use plus sign:
=FILTER(H:H,(E:E="Authorization")+(E:E="bigwhale")+(E:E="hi"))

Related

Extracting Wanted Data from the Raw Cell

I have been trying to extract the required data from a single cell and I have tried using some common formulas but its not working for all the cells exactly.
I would appreciate your help in this regards.
Google Sheet
Formula 1
=LEFT(A2,FIND(C2,A2)-1)
Formula 2
=SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(LEFT(RIGHT(A2,len(A2)-FIND(") ",A2)),6),")",""),"(","")),"|","")
I duplicated your tab and entered the following formula in cell E2:
=ArrayFormula(ifna(regexextract(A2:A,"\[\s\]\s(.+)?\s\((.+)\)")))
Explanation
\[\s\]\s - find [ ]
(.+)?\s\( - extract everything after it until the next occurence of (
(.+)\) - extract everything after the above ( and before the next occurence of )
EDIT: The first time I've tried #ztiaa answer it didn't work... don't know why. I kept investigating REGEX and gave it another try, and it did... You'd probably prefer that. I leave my answer just as a memory, and if it's useful for someone else in another scenario
Honestly, I don't handle regex as #ztiaa, but what I've found difficult about your example is that there are sometimes more than one opening parenthesis... that's why I looked for a way of finding the last appearance of "(". You can learn more about this workaround here
I changed "#" with "CUT HERE" in my example, just in case "#" may appear in your example. With that in mind, you can set these two formulas:
=ArrayFormula(IF(A3:A="","",MID(A3:A,5,FIND("CUT HERE",SUBSTITUTE(A3:A,"(","CUT
HERE",LEN(A3:A)-LEN(SUBSTITUTE(A3:A,"(",""))))-5)))
=arrayformula(if(A3:A="","",mid(A3:A,FIND("CUT HERE",SUBSTITUTE(A3:A,"(","CUT
HERE",LEN(A3:A)-LEN(SUBSTITUTE(A3:A,"(",""))))+1,FIND(")",A3:A,FIND("CUT
HERE",SUBSTITUTE(A3:A,"(","CUT
HERE",LEN(A3:A)-LEN(SUBSTITUTE(A3:A,"(",""))))+1)-FIND("CUT
HERE",SUBSTITUTE(A3:A,"(","CUT
HERE",LEN(A3:A)-LEN(SUBSTITUTE(A3:A,"(",""))))-1)))
The second one is really long because it has to find the amount of characters in between brackets. But it appears to work. Probably there's a more ellegant way with Regex, I repeat :)
Look in J and K of your example:

Split Function with Index Match function

I have a column that has multiple comma separated values, I need to use Split function and then run index match on that column, is it possible ? if yes somebody can help pls
Yes, you can do this, I just tested it in google sheets.
=INDEX(<array>,MATCH(SPLIT(<cell>,","),<array>,0))
To be honest, I was googling for something similar and ran across this issue. My problem turned out to be that I was using ',' and NOT ",". I suspect you asked this question for similar reasons (you tried it and it didn't work). So just to confirm, it is totally possible, the issue is likely an error with your formula.
output of a minimal example, using the above formula, matching on the first split:

Google sheets - How to remove ALL the parenthesis with text inside in a cell?

For example i have this in the G33 cell:
Hello (example) world (example 2). How are you (example 3) ?
And i want to remove ALL of the 3 parenthesis with their texts so it becomes:
Hello world. How are you?
I have found some functions but they only remove the first parenthesis.
I want a function that will remove every parenthesis with their contents that exists on a cell.
Can someone provide me with one? I am a begginer in google sheets so my knowledge on functions is very restricted. so please help me
See if this helps
=regexreplace(G33, "(\s\(.*?\))",)
This is sufficient to remove a single level of parenthesis:
=regexreplace(A1,"\([^()]*\)","")
Replacing nested brackets appears challenging, but as a workaround you can nest the function to arbitrary depth like this:
=regexreplace(regexreplace(A1,"\([^()]*\)",""),"\([^()]*\)","")
This assumes that the brackets are correctly matched. You could run a quick check like this:
=len(substitute(A1,"(",""))=len(substitute(A1,")",""))
which at least checks that you have as many right brackets as left ones, but again checking that they are correctly matched would be more difficult.

=LEN Function in Google Sheet not working corretly

I have a column with lots of rows containing text. I want to highlight cells with over an x-amount of characters, but how? The code I'm using in combination with 'Conditional Formatting' is not working all the time. Sometimes it highlights text over the x amount and sometimes it doesn't, so there is something I'm doing wrong here. The x-amount in the example below is: 300.
you may also need to lock it like:
=LEN(E$1:E$170)>300
Silly me... I found the answer myself. I need to put in the same range in the formula as well. Formula with the range E1:E170 needs to be: =LEN(E1:E170)>300

Is there an extension for better UI when writing formulas?

Formulas in google sheets are always written out as on line. This makes it tedious to quickly understand them. Like when you are programming you use linebreak to make things more understandable. Is there an extension that auto structure formulas or something like that?
Short example. The following formula:
=TRIM(if(LEN(A141)>10,PROPER(A141),LOWER(A141)))
And the extension makes it look like this or something similar:
=TRIM(
if(LEN(A141)>10,
PROPER(A141),
LOWER(A141)
)
)
unfortunately, there isn't, but you can always achieve it manually by pressing CTRL + ENTER and inserting line breaks where you wish it
=TRIM(
IF(LEN(A141)>10,
PROPER(A141),
LOWER (A141)
)
)

Resources