Cell value represents a list.
Line breaks in cell represents number of items in list
Need to identify number of items in list.
Correction
The formula is incorrect for empty cells, use instead:
= LEN(A1) - LEN(SUBSTITUTE(A1, CHAR(10), "")) + 1 * COUNTA(A1)
Assuming your cell is A1
Turns out this link figured it out:
https://www.extendoffice.com/documents/excel/4785-excel-count-newlines.html
Equation where A2 is the cell you want to count the line breaks:
=LEN(A2)-LEN(SUBSTITUTE(A2,CHAR(10),""))+1
Related
I am trying to format a group of cells but I need a custom formula for when the value of a cell is greater than the value of the cell in its column of a specific row it needs to be highlighted
(The highlighted value reference point in the group is in the same row)
Please help 😞
I tried to highlight by using the default option on each column but there are way too many rows
I don't have your exact spreadsheet. Let's say your range goes from A1:Z, and that the column of reference is column E (from each row). Then you can set this formula to:
=A1 > $E1
Change A1 to the first cell of your range and $E1 with the first corresponding column of the first row of the rage (if you start row 3, then put $E3 -- and change the letter ;) )
Let me know if this works for you!
Here's the thing I want to do:
For every cell in A2:A, find all instances where the string is a substring of a cell in B2:B, and return all the cell indices (offsetted by a column) concatenated into a single string.
I'm currently using =TEXTJOIN(",",true,IFERROR(ARRAYFORMULA(SEARCH(A2,B$2:B)))) which gives me the first occurrences within the text. I also know how to use the OFFSET function. How do I get the cell indices instead?
picture of sheet
=TEXTJOIN(",",TRUE,FILTER(B:B,REGEXMATCH(C:C,B2)))
FILTER(B:B,REGEXMATCH(C:C,B2) - Filter out all rows in B column if the corresponding row in C column has the specified string (e.g. AA).
For example I have 500+ rows of data that is formatted as example:
Hamilton Washington 30 OR 12345
The issue is the last item in the cell is a zip code and I need to copy it into another cell.
The number of items in each cell is not the same so split text leaves it in different columns.
I essentially want the "12345" or last item in the cell since for all of them it will be the zip code.
Thanks
Suppose that your original string data is in A2:A. You could place the following formula in B2 (assuming B2:B is empty first):
=ArrayFormula(IF(A2:A="",,REGEXEXTRACT(A2:A,"\s([\S]+)$")))
This means "If a cell in A2:A is blank, leave the corresponding cell in B2:B blank; otherwise, return the last group of non-spaces that follows a space and ends with the end of the string."
You can try this function below & adjust it to your own setup:
=ARRAYFORMULA(TRIM(RIGHT(SUBSTITUTE(A1:A," ",REPT(" ",10)),10)))
Sample Result:
Reference:
Extract the Last Word In Excel & Google Sheets
TRIM
RIGHT
SUBTITUTE
REPT
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.
In Google Sheets I need to reference a cell by (column, row) in a way where I can replace "row" with a formula to find a specific row. In other words I can't use a reference like "A7" because my row is determined by a formula.
Here is the formula that gives me my row number:
=ArrayFormula(MAX(FILTER(ROW(B:B);NOT(ISBLANK(B:B)))))
You can use indirect() to dynamically reference cells
Use: indirect("string that evaluates to a reference")
example: =Indirect("A"&B2) copies the value of the cell with the row in B2 in column A
In your case, it would be (replace [column] with the desired column):
indirect("[column]"&ArrayFormula(MAX(FILTER(ROW(B:B);NOT(ISBLANK(B:B))))))