How to combine data and then separate concatenated data? - google-sheets

I would like to combine a range of data into one single cell G5.
Then I want to split Value G5 into original form. Thank you so much.
https://docs.google.com/spreadsheets/d/1sVrpPvtQPG0Zw2Ar_UxPHXNN0atEdQNX-hkyB2ixUGw/edit?usp=sharing

ER1:
=ARRAYFORMULA(TRIM(REGEXREPLACE(QUERY(FLATTEN(QUERY(TRANSPOSE(
{A1:B3&" |", C1:C3}),,9^9))&"♦",,9^9), "♦ |♦$", CHAR(10))))
ER2:
=ARRAYFORMULA(TRIM(SPLIT(FLATTEN(SPLIT(G5, CHAR(10))), "|")))

Related

How to split data in one cell to multiple rows and columns?

I'd like to split the data from cell to cell. I have a google sheet and in Column "I" I have technical information about products like this:  
So I'd like to split it as shown in the image. What can I do? or Can you give me directions about which function or formule I need to read to solve this kind of question. Thanks a lot for help
From what I can see, you may need two splits: one to split rows in a cell, and the other to split records in two parts (description, value). To do this we can combine these functions:
JOIN to get all values in a column as one chunk;
SPLIT to separate values;
TRANSPOSE to organise splitted rows vertically;
ARRAYFORMULA to apply SPLIT as an array function.
=ARRAYFORMULA(SPLIT(TRANSPOSE(SPLIT(JOIN(CHAR(10), I:I), CHAR(10)))," "))
Notes:
JOIN(CHAR(10),I:I) - concatenate the data in the I column into one data block;
SPLIT(..., CHAR(10)) - split data by Char(10);
TRANSPOSE(...) - arrange splitted rows vertically;
SPLIT(..., " ") - split by spaces, note that there's a parameter remove_empty_text which by default is true, i.e. treat consecutive delimiters as one, what suits your case;
ARRAYFORMULA - make splitting to work as an array-formula.
Example:

Splitting Text and Formatting it - Google Sheets

I have a log file with three fields, the first two are userIDs and the third is an item description. Can I use a single formula to Split the text, format the first 2 items, and leave the 3rd alone?
Sample Data:
<#!9812391203019>; <#!98120319283> ; Short Description
Formula Currently used:
=ARRAYFORMULA(REGEXEXTRACT(TRIM(SPLIT(A3,";")),"[0-9]+"))
This works to extract the userID from the unneeded in the first two columns but will only give me numbers for the third.
Previous Formula was within the REGEXEXTRACT but it left the unneeded "<#!" and ">" in the columns which I wanted to remove.
Any help and suggestions would be appreciated! Thanks in advance!
Does this work?
=Split(RegexReplace(A1,"[<#!>]",),"; ",0)
try:
=INDEX(IFERROR(REGEXREPLACE(TRIM(SPLIT(A1:A5, ";")), "[#!<>]", )))

Cannot use nested IF for CONCATENATE function

I have a column of data and need to use CONCATENATE to combine them as a string.
=CONCATENATE("{",char(34),0,char(34),":",B2,char(34),
IF(A3="Yes",CONCATENATE(",",char(34),1,char(34),":",B3),
IF(A4="Yes",CONCATENATE(",",char(34),2,char(34),":",B4),
IF(A5="Yes",CONCATENATE(",",char(34),1,char(34),":",B5),
IF(A6="Yes",CONCATENATE(",",char(34),1,char(34),":",B6))))),"}")
However, it only combines the first 2 data. Please help.
Demo sheet: https://docs.google.com/spreadsheets/d/1-xZr2SC2t2E5QKtmTD1kQFr-K8GgJjIHL83Wqr6xYF8/edit#gid=0
Try this:
="{"&JOIN(",",FILTER(CHAR(34)&SEQUENCE(5,1,0)&CHAR(34)&":"&B2:B6,A2:A6="Yes"))&"}"

Fetching data from other Spreadsheet by comparing some values

I have a sample Spreadsheet such as
And I want to import data from this spreadsheet to another spreadsheet, but after comparing some data, such as
My noob formula for the selected cell name in the second image:
=Query(ImportRange("URL of first spreadsheet","sheet!B:D"),"Select Col2 where Col2=A.....(what to add here? this column 'A' is not working for comparing the names)
My Approach:
I will compare the values from the import range with the existing column i.e. previousSpreadsheet.name.A=thisSpreadsheet.this_name.A and compare every name and SELECT values accordingly for the next three columns (in yellow). I hope I'm clear.
What should I add here? Is my approach right? If not, What are the alternatives to achieve this?
Thanks.
EDIT
(following OP's request)
Also, can I compare two cols with one? such as where LOWER(Col2)='"&LOWER(A2)&"' or '"&F2&"' or Col2=A2 || F2 something like this? for comparing two cols with one?
If you start using more than one names as variables, you may want to consider using other alternatives for the where clause, like matches
=Query(ImportRange("URL of first spreadsheet","sheet!B:D"),
"Select Col2 where Lower(Col2) matches'"&LOWER({A2&"|"&F2})&"'")
Original answer
Please use
=Query(ImportRange("URL of first spreadsheet","sheet!B:D"),"Select Col2 where Col2='"&A2&"'")
(where A2 is the name you need)
Pay notice to the syntax referring the cell: single quotes ' double quotes" ampersand & cell A2 and again &"'.
No spaces in between
try:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, IMPORTRANGE("ID", "sheet!B:D"), {1,2,3}, 0)))

Can I use an arrayformula with a split arrayformula inside it?

Trying to break apart rows containing numbers like "198,183,158,315,274" by their comma, and then average them out and divide them by a singular number; using arrayformula. It only produces one row of result and it's incorrect though?
Here is my test sheet, editable
Thanks for any help.
try:
=ARRAYFORMULA({"Average"; IF(A4:A="",,
IFNA((MMULT(1*IFERROR(SPLIT(INDIRECT("A4:A"&
MAX(IF(A4:A="",,ROW(A4:A)))), ",")),
ROW(INDIRECT("A1:A"&COLUMNS(SPLIT(A4:A, ","))))^0)/
(1+LEN(REGEXREPLACE(A4:A&"", "[0-9\. ]", ))))/B1))})
spreadsheet demo
Another solution:
=ArrayFormula({"Average";(ArrayFormula(mmult(N(array_constrain(ArrayFormula(IFERROR(SPLIT(A4:A8,","))),MATCH(2,1/(A4:A8<>""),1),5)),sequence(Columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)/mmult(N(array_constrain(if(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))>0,1,0),MATCH(2,1/(A4:A8<>""),1),5)),sequence(columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)))/$B$1})

Resources