Please give me an ArrayFormula for this formula - google-sheets

I want to achieve column I.
Formula is:
=textjoin(char(10),false,A4:F4)
When I convert to Arrayfromula:
=transpose(split(textjoin(char(10),false,{ArrayFormula("~"&A4:A),A4:F}),"~"))
Editable Sheet link
In my Arrayformula the first value is repeating, Please Help!
EDIT:
Is there any way to achieve Arrayformula 1 (two columns) & Arrayformula 2 (single column)?
Numbers sheet:
(Basically not include cells with value 0)
The formula should even work with Strings as data not compulsorily Numbers as shown below:
Strings & Numbers sheet:
(Basically not include cells with value 0 & NULL)

try:
=ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE(FLATTEN(QUERY(TRANSPOSE(
TO_TEXT(A4:F6)&"×"),,9^9)), "×", CHAR(10)), " ", ))
update:
=ARRAYFORMULA({IF(TRIM(FLATTEN(QUERY(TRANSPOSE(A4:F),,
9^9)))="",,JOIN(CHAR(10), A1:F1)),
REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(FLATTEN(QUERY(TRANSPOSE(
TO_TEXT(SUBSTITUTE(A4:F, " ", "♀"))&"×"),,
9^9)), "×", CHAR(10)), " |\n$", ), "♀", " ")})
=ARRAYFORMULA(IF(TRIM(FLATTEN(QUERY(TRANSPOSE(A4:F),,9^9)))="",,
REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(FLATTEN(QUERY(TRANSPOSE(
TO_TEXT(SUBSTITUTE(IF(A4:F="",,A1:F1&": "&A4:F), " ", "♀"))&"×"),,
9^9)), "×", CHAR(10)), " |\n$", ), "♀", " ")))

Related

Table to 9^9 query header to table again

I have this sheet with a table
I want to go from the table to nested header and back to table again from the nested ranges header.
I tried using split transpose to expand the table, but it didn't work.
looking at your dataset it is not possible to go from A12 to A16. you will need to attach some unique symbols first and only then you can cut it with split fx
in A12 use:
=ARRAYFORMULA(QUERY(SUBSTITUTE(TRIM(A1:E9), " ", "♦"),,9^9))
in A16 use:
=ARRAYFORMULA(SUBSTITUTE(TRANSPOSE(SPLIT(FLATTEN(A12:E12), " ")), "♦", " "))
or full:
=ARRAYFORMULA(SUBSTITUTE(TRANSPOSE(SPLIT(FLATTEN(QUERY(SUBSTITUTE(
TRIM(A1:E9), " ", "♦"),,9^9)), " ")), "♦", " "))

Extract the difference between two Strings

I'm looking to extract the difference between two cells containing strings in Google sheets.
I've tried to use the search, split and regexextract formulas with no luck.
Cell A1;
- "IE, DE, FR, GB, IT"
Cell B1;
- "IE, FR, GB"
Cell C1; (The aim is to have cell C look as follows)
- "DE, IT"**
Any suggestions or solutions would be greatly appreciated!
Try in cell C1
=join(", " ,filter(split(A1,", "), (isna(match(split(A1,", "), split(B1, ", "),0)))))
and see if that works?
try:
=JOIN(", ", FILTER(SPLIT(A1, ", "),
NOT(COUNTIF(SPLIT(B1, ", "),
SPLIT(A1, ", ")))))

SPLIT QUERY results into separate rows when one column's data contains CSV

In this QUERY
=QUERY(QUERY(Estimate!A2:Y,"SELECT A,D,E,F,G,H,J,Y",0)
Column Y contains a CSV list. How can I split this up into multiple rows in the results?
I tried this, without success:
=QUERY(QUERY(Estimate!A2:Y,"SELECT A,D,E,F,G,H,J,'"&SPLIT(Estimate!Y2,", ",TRUE,TRUE)&"'",0),"OFFSET 1",0)
My sheet
=ARRAYFORMULA(TRIM(SUBSTITUTE(SPLIT(TRANSPOSE(QUERY(TRANSPOSE(QUERY(
SUBSTITUTE(A2:C, " ", "♦"), "select Col1,Col2,Col3", 0)),, 999^99)), " ,"), "♦", " ")))
=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(IFERROR(SPLIT(C2:C, ","))<>"", "♦"&A2:A&"♠"&B2:B&"♠"&SPLIT(C2:C, ","), ))
,,999^99)),,999^99), "♦")), "♠")))

Normalize Data in Google Sheets - TRANSPOSE multiple columns Fill Down

I have data I need normalized. Any value in Col C separated by a comma needs its own row.
Here is my sheet
The Data is in Col A - Col C and the Desired Result is int Col E-ColG.
This question was helpful and I got the formula working for col C but when I try to integrate col A and B it breaks:
Transpose, Split, and Join Google Sheets
a scalable modification of #ttarchala's solution:
=ARRAYFORMULA(QUERY(SPLIT(TRANSPOSE(SPLIT(IFERROR(TEXTJOIN(
"♦", 1, $A3:A&"♠"&$B3:B&"♠"&IFERROR(SPLIT(C3:C, ", ")))), "♦")), "♠"),
"where Col2<>'' and Col3<>''"))
=ARRAYFORMULA(QUERY(SPLIT(TRANSPOSE(SPLIT(IFERROR(TEXTJOIN( "♦", 1,
SUBSTITUTE($A3:A&"♠"&$B3:B&"♠"&IFERROR(SPLIT(
REGEXREPLACE(C3:C, ", |,", "♥"), "♥")), "♠♠", ""))), "♦")), "♠"), "where Col3<>''"))
This rather long formula will do what you want
=query(
arrayformula(
split(
transpose(
split(
textjoin(
"\",
0,
$B3:B4 &
"|" &
split(C3:C4, ", ")
),
"\"
)
),
"|"
)
),
"select * where Col2 <> ''"
)
Explanation: really too long and too boring to write. Just rebuild the query starting from the innermost formulas to see how it works.
Adding the column A is left as an exercise to the reader.

Concatenate or insert a number into a QUERY() string in Google Sheets

I am trying to use QUERY() to call a column of data from one sheet to another based on the contents of other columns. The code below works just fine.
=query(Data!$A1:$Y15), "select Col7 where Col1 starts with """&E$2&""" ")
However, I want to copy this data and have Col7 change to match the row of the cell that the formula is in + 1. It should be something like this (the formula is in cell F6):
=query(Data!$A1:$Y15), "select Col"""Row(F6) + 1""" where Col1 starts with """&E$2&""" ")
How can I concatenate or insert a number into a query string? I do need to use query due to some other constraints I simplified out of this example.
Just use & for concatenation, the way you did around E$2.
"select Col" & Row(F6) + 1 & " where Col1 starts with """ & E$2 & """ "
I would also use single quotes around the string from E$2, because they don't need to be escaped by doubling:
"select Col" & Row(F6) + 1 & " where Col1 starts with '" & E$2 & "'"
Also, Row(F6) could be simply Row() which returns the row of the current cell.

Resources