Get substring after penultimate space in Google Sheets - google-sheets

I had a pretty similar question, but this case is more complicated, and it probably could be helpful for someone.
Is it also possible to get first substring after penultimate space?
'Viatti V-130 Strada Asimmetrico 215/60 R16 95V' - get R16
'Viatti Vettore Brina V-525 205/70 R15C 106/104R' - get R15C
Thanks for your time!

try:
=INDEX(IFNA(REGEXEXTRACT(REGEXEXTRACT(A1:A, "(.+) "), "([^ ]+)$")))

Supposing your data to process is in A2:A, this should do it:
=ArrayFormula(IFERROR(REGEXEXTRACT(A2:A,"(\S+)\s\S+$")))

Related

How to make this formula shorter in google sheets

I would like to know what product I exactly have with this sheet. So I add in column O for help. However, my formula seems to be too long to maintain in the future, and it will always have a "/" in the end.
This is my formula in O2
=if(isblank($A2),,$A$1&"/")& if(isblank($B2),,$B$1&"/")& if(isblank($C2),,$C$1&"/")& if(isblank($D2),,$D$1&"/")& if(isblank($E2),,$E$1&"/")& if(isblank($F2),,$F$1&"/")& if(isblank($G2),,$G$1&"/")& if(isblank($H2),,$H$1&"/")& if(isblank($I2),,$I$1&"/")& if(isblank($J2),,$J$1&"/")& if(isblank($K2),,$K$1&"/")& if(isblank($L2),,$L$1&"/")& if(isblank($M2),,$M$1&"/")&
How could I improve this forluma? Thanks!
You need TEXTJOIN() and FILTER() function.
=TEXTJOIN("/",1,FILTER($A$1:$N$1,A2:N2=1))
to process the whole array at one use:
=IFERROR(BYROW(A2:N, LAMBDA(x, TEXTJOIN("/", 1, FILTER(A1:N1, x<>"")))))

Scalable Regexmatch formular

i need help with the following formula:
IF(REGEXMATCH(LOWER(B3), JOIN("|",Keywords!H$2:H$13)),"unqualified","qualified")
B3 is in this Case the String "I need help". My problem is that id like to use the Formula
IF(REGEXMATCH(LOWER(B3), JOIN("|",Keywords!H$2:H)),"unqualified","qualified")
so i dont always need to match the Row with the Keywords. Otherwise i have Spaces in the join formular and the results are always "unqualified".
Does anyone has an idea how i can rewrite this formula into a more "scalable Version"?
I hope everything i explained was understandable.
Try this out. You can remove the LOWER and make the regex case insensitive
=ARRAYFORMULA(
IF(ISBLANK(B3:B),,
IF(
REGEXMATCH(
B3:B,
"(?i)"&TEXTJOIN("|",TRUE,Keywords!H2:H13)),
"unqualified",
"qualified")))
I solved my problem with this formula:
IF(REGEXMATCH(LOWER(B3), JOIN("|",QUERY(G$2:G,"select G Where G is not null"))),"unqualified","qualified")

Formular for counting names in a spreadsheet which are seperated with , or /

so I want to count the names in a cell which are separated with , or / like that
I tried several thing but nothing seems to work and I always get an error, can you help me out?
I tried the following formulas:
=ArrayFormula(if(len(B457:B),len(B457:B)-len(SUBSTITUTE(B457:B,",",""))+1,))
OR even easier like:
This
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1
It would be enough if it would just count all names separated with , ...so we'd just tell people to ad a , to separate their names and not a /..but it would be nice if both would work!
Thanks so much in advance!
Best regards
Paul
use semicolon:
=ARRAYFORMULA(IF(LEN(B457:B); LEN(B457:B)-LEN(SUBSTITUTE(B457:B; ","; ""))+1; ))
Try this in cell C457 (removing all content below):
=arrayformula(if(B457:B<>"",len(regexreplace(regexreplace(B457:B,"[\/\,]$",),"[^\/\,]+",))+1,))
My example sheet screengrab works from row 2:

How to ignore text/strings in google sheet Sum calculation?

If I have a Text in a sum calculation which I would like to ignore. On the picture below you can see my formula. The text OFF is throwing an error on total hours for me. Any help is appreciated.
Your SUM function is pointless the way you have written it as you're already calculating the result with + and - operators (which is why you get the error). Try:
=SUM(C4,E4,G4,I4,K4,M4,O4)-SUM(B4,D4,F4,H4,J4,L4,N4)
Another approach:
=SUMIF(B3:O3,"End",B4:O4)-SUMIF(B3:O3,"Start",B4:O4)

Can I use an arrayformula with a split arrayformula inside it?

Trying to break apart rows containing numbers like "198,183,158,315,274" by their comma, and then average them out and divide them by a singular number; using arrayformula. It only produces one row of result and it's incorrect though?
Here is my test sheet, editable
Thanks for any help.
try:
=ARRAYFORMULA({"Average"; IF(A4:A="",,
IFNA((MMULT(1*IFERROR(SPLIT(INDIRECT("A4:A"&
MAX(IF(A4:A="",,ROW(A4:A)))), ",")),
ROW(INDIRECT("A1:A"&COLUMNS(SPLIT(A4:A, ","))))^0)/
(1+LEN(REGEXREPLACE(A4:A&"", "[0-9\. ]", ))))/B1))})
spreadsheet demo
Another solution:
=ArrayFormula({"Average";(ArrayFormula(mmult(N(array_constrain(ArrayFormula(IFERROR(SPLIT(A4:A8,","))),MATCH(2,1/(A4:A8<>""),1),5)),sequence(Columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)/mmult(N(array_constrain(if(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))>0,1,0),MATCH(2,1/(A4:A8<>""),1),5)),sequence(columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)))/$B$1})

Resources