I have a column containing strings of emojis with no space in between of various lengths on Sheets and I would like to split them into separate columns each containing just one emoji.
Examples:
Input 😍💙💛
Output 😍|💙|💛
Sheets doesn't have the split to fixed width function unlike Excel, and can't use Excel because certain emojis are rendered incorrectly.
Assuming emojis in A1, try
=split(regexreplace(A1, "(.)", "_$1"), "_")
and see if that works?
Related
I'm working in Google Sheets. I have a few hundred cells that contain text and numbers. The cells contain employee names and their ID#s. I want to extract the ID#s and compile them into one list. I have the formula below that will let me complete the task, but only for one cell, not for a range of cells (even if I select a range and add it to the formula):
=transpose(split(regexreplace(regexreplace(A1,"\s\d+\s"," "),"[^\d\.]"," ")," "))
For example, cell A1 would contain, "Tammy - 123456, Bob - 654987, Mike - 321456" and repeat similar until you get to something like cell DT75 "Marcus - 35768, Bruce - 95126, Lisa - 789123". Some cells in the sheet are blank. The above formula will give me the ID#s from A1 in their own cells:
123456
654987
321456
I'd like to get one column of all the ID#s in the sheet that I could then copy and paste into a completely different proprietary database. Am I coming at this the wrong way? Is a script a better angle?
Since you want your original range to be multi-column, you could try a slightly modified version of player0's formula, like this:
Use CONCATENATE to put all data in a single string.
REGEXREPLACE to remove everything but the numbers from your string.
SPLIT to divide your string into several cells, blank space being the separator.
FLATTEN put all resulting values into a single column.
=FLATTEN(SPLIT(REGEXREPLACE(CONCATENATE(A:DT), "[A-Za-z-,]+", )," "))
try:
=INDEX(FLATTEN(SPLIT(QUERY(REGEXREPLACE(A1:A, "[A-Za-z-,]+", ),,9^9), " ")))
for multi-column:
=INDEX(FLATTEN(SPLIT(FLATTEN(QUERY(REGEXREPLACE(A1:C, "[A-Za-z-,]+", ),,9^9)), " ")))
I have a spreadsheet where I manually copy and paste some data from pdf tables.
I've been using array query split to split that info into different columns and it works flawless in 2 columns (date and amount) and for the other one it works most of the time (reference).
Example that works:
PDF DATA: 4500063794 21.07.2020 187.50
COLUMNS IN SPREADSHEET (final result after split): Reference:4500063794, Date:21.07.2020, Amount:187.50
Formula for retrieving Reference column: =ArrayFormula(QUERY(SPLIT(C3:C7 ;" ");"select Col1";0))
This works along the spreadsheet without any problems
Another example that works:
PDF DATA: 447/20.6TBOS 04.07.2020 804.00
COLUMNS IN SPREADSHEET (final result after split): Reference:447/20.6TBOS, Date:04.07.2020, Amount:804.00
Formula for retrieving Reference column: =ArrayFormula(QUERY(SPLIT(C3:C7 ;" ");"select Col1";0))
This works along the spreadsheet without any problems
Example that DOES NOT work:
If I paste several rows like 1st example and then add several rows as the 2nd example, when I paste afterwards more data like the one in 1st example, split stops retrieving the Reference column for pdf data similar to "447/20.6TBOS 04.07.2020 804.00" (2nd example). It retrieves blank cells for these.
Can anyone shine a light on this?
Thanks in advance
Example Spreadsheet
It will work if you change the query to:
=ArrayFormula(INDEX(SPLIT(REGEXREPLACE(C3:C7; "\s"; "♥");"♥");ROW(C3:C7)-ROW(C3);1))
The formula will replace the spaces by hearts (rare character) and then it will populate the rest.
To change the values of the rows, just change the last character 1 to 2 or 3:
)-ROW(C3); ==> 1 ))
You can use the same formula to the G column (don't forget to update the ranges), as the delimiters of both of the 4500063794 21.07.2020 187.50 and the 447/20.6TBOS 04.07.2020 804.00 are the same (whitespaces).
This is the example sheet.
Alright, in cell V1!A1 is the formula ={"Languages";ARRAYFORMULA(TRANSPOSE(QUERY(TRANSPOSE(B2:F&","),,COLUMNS(B2:F))))}. I need to combine data from B2:F with the delimiter ,. But now I need to delete the unnecessary delimiters.
In sheet V2, I tried ={"Languages";ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE(TRANSPOSE(QUERY(TRANSPOSE(B2:F&","),,COLUMNS(B2:F))),"(^(,(\s,){4})$)|(^(,\s)+)|(,(\s,)?\s?$)",""),"(,\s,)+\s?",", "))} but it's not consistant and still leaves delimiters in the output.
Is there a better way to do this?
I added a sheet called "Erik Help" which replaces your formula with the following:
=ARRAYFORMULA({"Languages";SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(B2:F&" "),,COLUMNS(B2:F))))," ",", ")})
Essentially, instead of appending a comma to elements of the range B2:F, I appended a space. Then I applied TRIM to the results, which will leave no spaces before or after each concatenation and only one between each element. To that, I applied a SUBSTITUTE of the single spaces with a comma-space.
I have a list of IDs like this :
40316C1
40316433D112
4316C1
4Z2
40316B2
40310
I would like to return the IDs like this:
40316
40316433
4316
4
40316
40310
Basically, from the first alphabet Character, Trim or Split the rest on the right.
Can I do this in Google Sheets?
You can do it with REGEXEXTRACT
Sample:
=REGEXEXTRACT(A1,"\d{1,20}")
This formula will evaluate the first 20 characters of the IDS (you can change 20 to ahigher number if necessary`
\d means that the formula will extract only numbers from the IDs - until it finds the first non-number.
UPDATE:
The case of no text characters existing in the cell can be caught with =IFERROR
=IFERROR(REGEXEXTRACT(A5,"\d{1,20}"),A5)+0
I need help to convert a string in a single cell in line breaks to separate rows. I've tried it copying the string in google sheet then paste in excel sheet it works but too tedious to do because there are many records.
Input:
cell A1 linebreak format without space
Apple
Banana
Grapes
Output:
A1=Apple A2=Banana A3=Grapes
you can do:
=TRANSPOSE(SPLIT(B1, CHAR(10)))