=LEN Function in Google Sheet not working corretly - google-sheets

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

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:

Google Sheets Conditional Formatting not right sometimes

I am trying to create a google sheet to track some payments and have created some conditional formatting rules to show when there is under/over/correct payments. It seems to work correctly, except for one set. I am linking to a spreadsheet so hopefully you can view it.
https://docs.google.com/spreadsheets/d/1IJ6zFXP2cMRQmbf3KSFEcO_H36CP3sBwp1dfvJMSDmc/edit?usp=sharing
It seems to go wrong on one particular set...line 19 shows that 26 cents is still owed - it shows correct. If you then look at line 14 (it works upwards), the Still Owed shows as $0.00 and not $ - and it shows in red and not white. And from then and upward, even though nothing is owed, it doesn't show right. However, I tried on line 15 making it show a penny is owed, and then line 10, it was paid off and so is $0 owed and it shows right.
I've tried copying the formatting and checking all the columns and I think they all look the same.
Any ideas how to fix it?
You should use Custom formula in Conditional Formatting.
Note: Use VALUE() in Format rules helps you to shorten the content Apply to range, because that ignores text cells
I think it's a (lack of rounding up/down) issue.
I changed the formula in S14 from:
=SUM(F14-G14+K14-L14+P14-Q14)
to:
=round(SUM(F14-G14+K14-L14+P14-Q14),2)
This way it will disregard any decimals beyond the second and thus make $ 0,00 truly 0.

Number/Word Splicer for Google Spreadsheets

I am trying to make a google spreadsheet that splits a word or string of numbers in half and puts the back half in front of the first half in a new column. However, I am new to this who process and so I came here to ask for help. I originally tried macros but couldn't get them to copy and paste information from columns.
Here is the basic idea:
The spreadsheet cuts the number or word in half putting the back in front.
Thanks for everyone's time.
In case of an odd number of chars, ROUNDUP must be used in RIGHT or LEFT function:
=ArrayFormula(RIGHT(A1:A,ROUNDUP(LEN(A1:A)/2)) & left(A1:A,LEN(A1:A)/2))
I think your problem shall be solved using the following code:
=CONCATENATE(right(A2,len(A2)/2),LEFT(A2,len(A2)/2))

What would short versions of given formulas be and how do you do it in general?

I am studying for a test and I would really appreciate some help with this. The instructions are simply to write these formulas in a shorter version. I understand how IF works; if the expression is true, it returns the first value, otherwise the second one (they are separated by semicolons).
Given examples are:
=D$5+IF(C4>1;F8-A12/4-53;F8-A12/4-B12+1)
=IF(C4="test";A4-55+C13;22+(C13+B2+A4))
=C3*IF(AND(C4="P";C5="P");4*A4/(1-m);m*A4-n*A4);
=IF(B3<>0;2*C6;2*IF(B3=2;SIN(omega*t-$A$2);0)
Explanation will be greatly appreciated.
The first formula can be shortened to:
=D$5+F8-A12/4+IF(C4>1;-53;-B12+1)
It's just a matter of factoring out F8-A12 since it is used twice.
To test this, I filled in some numbers into the cells mentioned, and it produced the correct result.
Similarly in the second formula, A4 and C13 are used twice and they could be factored out to be used only once.
In the third formula, everything is getting multiplied by A4 so it could be factored out.
In the fourth formula, it looks like 2 is the only thing that could be factored out.

How can I use the OFFSET() formula with a range of values?

EDIT: Disclaimer about the XY problem: The actual, concrete problem I'm trying to solve is: How can I make "recursive" (is that the right term here?) formulas that use infinite ranges in Google Spreadsheets/Excel? The solution I'm working with involves the OFFSET() formula. I'm asking this question because I'd like to get an extensible understanding of the way formulas use and implement ranges, especially infinite ranges.
I'm working in Google Spreadsheets and trying to create ArrayFormulas that will automatically expand without needing to use the fill handle as new data is added in the requisite columns.
To do this, I want to use infinite ranges such as A2:A when I do calculations so that no matter how much data is added, I'll never have to drag-fill any data or formulas and I can just let the spreadsheet iterate and do the work.
I'm running into a problem, though, when I try to use these infinite ranges with the OFFSET() formula. What I'm trying to do is have each cell in the range pull values from a couple of the cells next to it (thus the offset), do a simple calculation with those values, and make that the new cell value. But because the formula interprets the instruction as attempting to offset an entire (infinite) range of values, it returns a #REF! error. Here's a shared example sheet that demonstrates what I'm trying to do.
https://docs.google.com/spreadsheets/d/1V3ldSBoCrzyVWcn66wFBkDOmxt6iuYgtiU_H4KQ6J14/
If for some reason you can't see the formulas, the formulas I'm using are:
C3 =ArrayFormula(Offset(C3:C, 0, -1) - Offset(C3:C, -1, -1))
F4 =Arrayformula(Offset(F3:F, 0, -1) + Offset(F3:F, -1, 0))
Both of these return a #REF! error. C3's alt-text reads: "Error: Result was not automatically expanded, please insert more rows (1)." F3's alt-text reads: "Error: Circular dependency detected."
I'm decently confident why these don't work - you're apparently not allowed to use and refer to ranges this way. I don't, however, know how to fix this.
The two use-cases in the spreadsheet are essentially the same thing, backwards. Chances are if I can figure out one I can reverse-engineer it to work for the other one, but I've had no luck so far.
I've Googled around a lot and while I've never found anything that solves this problem, a lot of similar problems seem to be solved by using the INDIRECT() function. I can't understand how this would apply here, though, that function seems to be strictly for parsing values dynamically from cells with variable input.
(I should probably mention that this data is on a back end sheet and it's getting pulled on another sheet to display some charts on the front end. I wouldn't ask a question here if this data was the only thing involved.)
Any help or a step in the right direction would be appreciated.
If I'm understanding your question, one way to make an offset function expand automatically is to attach a count function, eg. in excel
=offset(C2,,,counta(C:C))
However, this will give you a circular reference error. To address this issue, this is one solution that I have used:
"OFFSET(C3,,,MATCH(9.99999999999999E+307,OFFSET(C3,,,ROWS(C:C)-ROW(C3))))"
This function passes an array based on the last number cell in the column. And for it to be used properly, it needs to be wrapped in a function that can handle arrays, like SUM().

Resources