Regex replace and split using Google SHeets formula - excel

I have a sheet where I need to split the numbers and text on single cell to 2 columns
https://docs.google.com/spreadsheets/d/1ZaQmWCx2PH6Fhn3RVW9PKpnTv0ML9zAHWzmk3789b04/copy
Please note the data is in single cell and I need to split in 2 columns as shown in the image
The expected outout is
I have tried with =REGEXREPLACE(A796,"[0-9]","")

You may use 2 formula in 2 different cells for this:
Formula #1:
=REGEXREPLACE(A4,"[[:blank:]].*","")
This finds first space and removes everything after that so that we have only starting numbers left in the result.
Formula #1:
=REGEXREPLACE(A4,"[0-9]+[[:blank:]]+","")
This matches starting 1+ digits followed by 1+ whitespace and removes it so that we only have text after starting numbers.
Sheet Demo

You can also try- B2
=TEXTJOIN(CHAR(10),False,INDEX(ArrayFormula(SPLIT(SUBSTITUTE(TRANSPOSE(SPLIT(A2,CHAR(10)))," ","#",1),"#")),,1))
C2=
=TEXTJOIN(CHAR(10),False,INDEX(ArrayFormula(SPLIT(SUBSTITUTE(TRANSPOSE(SPLIT(A2,CHAR(10)))," ","#",1),"#")),,2))

Related

How to make visible only last 3 characters from Excel cell

I have a row that contains different numbers. first 5 characters from each cell are equal, difference is only in last 3 characters (Example: 10265083, 10265154, 10265360).
I don't need to make the cell so wide as length of the number, because the sheet will be too large visually. So I need to see only last 3 characters in cell. In formula bar should be the whole number, because I need to use full number for further formulas.
Is it possible to do something like this?
I tried all kinds of cell formatting, I didn't find any way only to show the last three digits. Therefore I opt for another approach: just create a helper column, containing the following formula: =MOD(J7,1000).

How to make a repeating pattern in MS Excel with running alphabet letters and numbers

I've been trying to search the web for an answer with no avail so I decided to ask this here. I have a matrix in MS Excel and I would like to find a repeating pattern on the last row of the matrix such that both the column letter and the row number are running in the pattern.
I tried creating this pattern in the usual way by making few examples in the excel and then dragging the +-sign over the cells. However, only the alphabetical letter runs in the pattern but the numbers do not.
I have below a minimal working example. I have a 4 x 4 matrix and I would like the last row to contain all the diagonal elements of the matrix, that is the numbers 1, 6, 11 and 16. But when I try to repeat the pattern after manually plugging into the first three cells of the blue row as:
=A1, =C2, =B3
Then when I try to use the +-sign and repeat the pattern only the letter is incremented and I get the value in cell D1 instead. How to create a pattern which reads the diagonal elements of the matrix? Thank you!
UPDATE: Thank you everyone for your help. One addition to previous, many of the given formulas (for example the INDEX-approach) seem to work when my matrix is in the top-left corner of the Excel-file. I noticed that if I add rows or columns to the excel (above and on the left side of the matrix) the formula produces different values, why is this?
Here you see the INDEX-approach prior to adding any columns to excel:
And here you see the same matrix and formulas after adding one column on the left side of the matrix:
You can use =INDEX($A$1:$D$4,COLUMN(A1),COLUMN(A1))
Broken down:
column() indicates the current column, e.g. in column A it's 1, for B it's 2 etc
INDEX looks up the indicated row/column combination in the array
edit1: replaced indirect with index
edit2: changed column() to column(A1) as suggested by #JvdV
I created the yellow line with just 1 to 4 incremented.
Then in the blue cells, I have the formula as seen on screen :
As the point is just to get RiCi incremented from 1 to n, the formula in the blue cells becomes:
=INDIRECT("R"&A5&"C"&A5; FALSE)
That you can also drag on the left for autocompletion.
You can use the OFFSET function, to target a specific row/column using a base cell reference and an offset by a number of rows and columns. In your example here, in B5 you want to offset by 1 row and 1 column from A1 and so on...
So you could use the following formula in cell A5 and then copy across the row:
=OFFSET($A$1,COLUMN()-1,COLUMN()-1)
Edited: since I realised from #CIAndrews solution that A5:=COLUMN(A5) gives the same value as A5:=COLUMN(), and the latter is neater.

Counting lines of text after a specific word

I need to find out how many lines a character has in a play using Excel. The entire play is copied into one column in excel and I need to find out how many spoken lines a specific character has. When a character speaks, their name is listed in bold and all caps, followed by a blank cell then all of the lines they are speaking until another character speaks. At the end of their lines is another blank cell. So for example it would look like this:
1st CHARACTER
(Blank Cell)
"Line"
"Line"
"Line"
(Blank Cell)
2nd CHARACTER
I need a formula to count how many lines occur for the first character, but one that can be repeated for the entire play. Any ideas even if its just a preliminary formula would be greatly appreciated.
I have tried using COUNTIF, OFFSET, INDEX/MATCH and I just can not find the right combination to get the correct output and then apply that to the whole play.
Count lines of text after a specific word/character
Assume data housed in Column A with criteria in Column C
In D2, formula copied down :
=SUM(AGGREGATE(15,6,ROW(INDEX($A$1:$A$100,MATCH(C2,$A$1:$A$100,0)):$A$100)/(INDEX($A$1:$A$100,MATCH(C2,$A$1:$A$100,0)):$A$100=""),{1,2})*{-1,1})-1

How to bring in string from left of numbers in Excel

I'm trying to format a column based off of another (let's say column B2). The column contains a value like "ABC011" and I need to bring in just the letters "ABC".
For another column I also need to bring in just the numbers "011" but without the trailing zeroes (although I imagine that if I can get the solution for the first question I'll be able to figure out the second).
Thanks in advance.
EDIT: The length of the characters can change but the numbers are USUALLY 2 or more digits as well as the letters.
To isolate the first characters from the numbers, in C2 this array formula:
=MID(B2,1,MIN(IF(ISNUMBER(SEARCH({0,1,2,3,4,5,6,7,8,9},B2)),SEARCH({0,1,2,3,4,5,6,7,8,9},B2)))-1)
Being an array formula it must be confirmed with Ctrl-Shift-Enter when leaving edit mode. If done correctly then Excel will put {} around the formula.
If you have excel 2010 or later you can use this non CSE Formula instead of the one above. It does not require the Ctrl-Shift-Enter:
=MID(B2,1,AGGREGATE(15,6,SEARCH({0,1,2,3,4,5,6,7,8,9},B2),1)-1)
Then using that result in D2 we put:
=RIGHT(B2,LEN(B2)-LEN(C2))
This will put it in as a string, if yo want to make it a number just put -- in front:
=--RIGHT(B2,LEN(B2)-LEN(C2))
This will return the number as a number so 011 will become 11
To get the numbers

Concatenate numbers separated by dash while keeping leading zeros

I have two columns in Excel with leading zeros that I want to concatenate. The below code works perfectly. It concatenates the columns and retains the leading zeros from each column:
= A2&B2
However, I need a dash between the values. When I alter the formula to the following the leading zeros to the right of the dash are removed:
= A2&-B2
How do I add that dash while retaining all leading zeros?
Use Excel's CONCATENATE formula.
=CONCATENATE(A2,"-",B2)
Here, I use 00df9 in cell A2 and 00asd in cell B2 with a result of 00df9-00asd
if I've used two separate formulas using concatenate into one cell and both or one brings answer with decimals, how can I format to limit or remove (roundoff) the result numbers?
Here's the formula:
=CONCATENATE((F2/4.2),"/",((F2/4.2)/7))
and here's the example result: 273.809523809524/39.1156462585034
Now, for me, the idea solution is that the cell shows 234/39. Basically how (if at all) can I format that cell with concatenate formula?

Resources