Formula to change line break to row - google-sheets

ahi
a
bhi
hi
chi
b
hi
c
hi
In the data in column K, I want to divide the contents of cells containing newlines into rows! Can this be replaced using a formula?

Try:
=FLATTEN(SPLIT(TEXTJOIN(CHAR(10),1,K:K),CHAR(10)))

Related

Conditional Formatting for three columns range and their sum

My Input:
A B C
5 2 3
5 2 4
I want to conditionally format the row such as if A is not equal to B+C, then the entire row should be highlighted in red. In my case, second row should be highlighted as 5 != 2 + 4.
What I tried is adding a custom formula to the range - A2:C and the formula I tried is:
=A3 <> SUM(B3, C3) and some other ways, but couldn't figure it out.
PS: I want to create this formatting check for the entire column not just for a single row.
Any help is appreciated. Thanks.
Thanks to #Sergey's comment. The working formula is =$A2<>SUM($B2:$C2) for the range A2:C.

Adding the first digit(s) of a cell ending with specific letter

I have a sheet that has blocks of cells. I add them for a total if they don't contain any letter. Letters signify a specific variable or signifier code for tracking. I also want to add the cell value when a cell has an ending code letter. I've tried SUMIF, Substitute, SumProduct and a few others.
For a while I've used the following which worked till the S value changed to another number than "8" which then gave the wrong sum from the range.
=if(countif(D64:Q64,"*S")=0,"",((countif(D64:Q64,"*S"))*8))
In the cell range I have 5 variable groups ending in a letter (A, H, S, C and R) and one group not ending in any letter.
The formula I use to add the cells not containing a letter but have a value is this
=IF(SUM(AA64,(SUMIF(D65:Q65,"<>")),-(COUNTIF(D65:Q65,">=0")*8))>24,24,(SUM(AA64,(SUMIF(D65:Q65,"<>")),-(COUNTIF(D65:Q65,">=0")*8))))
which adds the table data plus the previous lines table data but does not exceed 24.
H is a set value of 6 and doesn't change.
Does anyone know how to add the value of the cells that contain a specific letter?
N (number)
A
S
C
R
H
8.5
H
8A
2S
9
3C
0.5R
17.5
8
2
3
0.5
6
I'd prefer it be a formula usable in Google Sheets because that is where this data is.
Solution:
You can use this formula below column "N" then drag right until below column "H".
=SWITCH(H$1,"N",SUM($A2:$G2),"H",6,SUM(IFERROR(ARRAYFORMULA(VALUE(LEFT($A2:$G2,FIND(H$1,$A2:$G2)-1))),0)))
This is a combination of three formulas:
If the row above is N, sum A2 to G2. This will ignore all the strings.
If the row above is H, output 6.
Else, get the number to the left of the defined suffix, set all others to 0, and get the sum.
Output:
References:
Extract number from string in Google Sheets
An alternative could be to use
=SUMPRODUCT(A3:G3, isnumber(A3:G3))
to compute the sum of the cells with numbers only, and to use
=sum(filter(substitute($A$3:$G$3, I$2,)+0, regexmatch($A$3:$G$3, I$2)))
under the 'A' and drag to the right
Examples

Google sheets subtract cells N columns and rows apart

how can I subtract cells A2 from A1 without directly using cell addresses? I would like to write A2 as a cell -1 column away and A1 as a cell -1 column away and -1 row away.
image
Thanks in advance <3
You can make use of the offset function on sheets.
An example formula based on your example would be: =(OFFSET(B2,0,-1)-OFFSET(B2,-1,-1))
You can use the INDIRECT function along with ADDRESS, ROW and COLUMN
=INDIRECT(ADDRESS(ROW(),COLUMN()-1))-INDIRECT(ADDRESS(ROW()-1,COLUMN()-1))
You can also use Indirect with RC notation as below:
=indirect("RC[-1]",false)-indirect("R[-1]C[-1]",false)

How to write a formula that would work in different rows?

I'm trying to make a Google spreadsheet where I want the sum of the values in the row to appear in the AH cell of that row.
The row would be populated with letters like L or X and I'm using COUNTIF to give value to the alphabet characters.
For example,
=COUNTIF(C4:AG4,"X")*9 + COUNTIF(C4:AG4,"L")*12
How can I write the range such that it looks at cells C through AG from the same row the formula is in rather than change it for every row?
You don't need to change the formula, if you write that formula in one cell and then you drag the little square at the bottom right of the cell, excel will automatically change the row number
Just copy downwards:
As you see, the row index changed to 5 automatically.

How do I organize formulas to work with columns in google sheets

Hi so I'm trying to make a spreadsheet in Google Sheets that takes two numbers and subtracts them and then does it in the next row .
So example the formula in C1 would be "subtract(A1, B1)" in the first row. But then in the next row I would like it to change to "subtract(A2, B2)" and output in C2.
(Without having to go in each C cell and change the formula of course)
So how do I do that and also how do I apply a formula to multiple cells of a row (C1,C2,C3,C4,C5, etc....)
Just put =MINUS(A1,B1) into C1 and then copy it and paste it in the remain rows of column C and the spreadsheet automatically adjusts the row numbers for you.
#Cooper's Answer above is perfect. I'm just giving a alternative here using array formulas, because it's easy.
Put this in D2
=ARRAYFORMULA(MINUS ( B2:B, MULTIPLY( 2.5, QUOTIENT(C2:C,15))))

Resources