Split comma separated data into multiple rows - google-sheets

The data below pulls from another sheet in the same workbook. This data below will update over time and have more rows (so it is not static).
How can I "split" this data so each shipment ID has its own row?
For the first row, this would look like:
The implemented logic would need to work for each row in the first image which means row 2 (with Shipment IDs F,G,H,I) would be split into four separate rows. The logic would need to be dynamic to be able to split more rows as they are pulled in from the other sheet.
Ideally, I do not want to use a script.

try this out:
={A1:D1;INDEX(QUERY(SPLIT(FLATTEN(C2:C&"|"&D2:D&"|"&MAP(A2:A,B2:B,LAMBDA(ax,bx,IFNA(SPLIT(ax,",")&"|"&SPLIT(bx,","))))),"|",0,0),"SELECT Col3,Col4,Col1,Col2 Where Col3!=''"))}

if A and B column are independent use:
=INDEX(LAMBDA(x, QUERY(IFERROR(SPLIT(FLATTEN(TRANSPOSE(FLATTEN(ROW(x)&"×"&
SPLIT(x, ",")))&"×"&FLATTEN(ROW(x)&"×"&SPLIT(OFFSET(x,,1), ",")&"×"&
OFFSET(x,,2)&"×"&OFFSET(x,,3))), "×")),
"select Col2,Col4,Col5,Col6
where Col6 is not null
and Col1=Col3
order by Col2", ))
(A11:INDEX(A:A, MAX(ROW(A:A)*(A:A<>"")))))

Related

How to SUMIF identical data spread out on multiple columns

I using excel to organize my cut list for a panel board. I have a table created like so, and i need help creating a formula that adds the number of pieces of panels of identical dimension and material, regardless of which panel it belongs
I have done formulas before where the datas where in a single column and there was only 1 criteria to check using UNIQUE and SUMIF formulas. I can already extract all the unique dimensions using
=UNIQUE(FLATTEN(C17:C19,E17:E19,G17:G19))
but that all that i got for now.
try:
={"Material", "Dimension", "Pcs";
QUERY({A2:C9; A2:A9, D2:E9; A2:A9, F2:G9},
"select Col1,Col2,sum(Col3) where Col1 is not null
group by Col1,Col2 label sum(Col3)''", 0)}

Can I automatically run another Goolge Sheets FILTER after/below a FILTER?

I am trying to make a simple grocery shopping list, where items can be checked and added to a filtered list. There will be different categories in different tabs/sheets (Produce, Dairy, Snacks, Household and Other). I currently have this filter in cell A1 of the SHOPPING LIST sheet:
=FILTER(Produce!B2:E,Produce!A2:A=TRUE)
Is it possible to have another filter run automatically after this, once the above filter runs and the number of rows is known? So that all filters run vertically to create the full shopping list:
=FILTER(Diary!B2:E,Dairy!A2:A=TRUE)
And then the next, etc.
=FILTER(Snacks!B2:E,Snacks!A2:A=TRUE)
=FILTER(Household!B2:E,Household!A2:A=TRUE)
=FILTER(Other!B2:E,Other!A2:A=TRUE)
UPDATE (Following OP's comment)
You can either use a QUERY instead
=QUERY({{Produce!A2:A; Diary!A2:A; Snacks!A2:A; Household!A2:A; Other!A2:A},
{Produce!B2:E; Diary!B2:E; Snacks!B2:E; Household!B2:E; Other!B2:E}},
"select Col2, Col3, Col4, Col5 where Col1=TRUE",0)
OR stick with the FILTER function
=IFERROR(
FILTER({Produce!B2:E; Diary!B2:E; Snacks!B2:E; Household!B2:E; Other!B2:E},
{Produce!A2:A; Diary!A2:A; Snacks!A2:A; Household!A2:A; Other!A2:A}=TRUE),
{"","","",""})
You could probably use something like:
={FILTER(Diary!B2:E,Dairy!A2:A=TRUE);
FILTER(Snacks!B2:E,Snacks!A2:A=TRUE);
FILTER(Household!B2:E,Household!A2:A=TRUE);
FILTER(Other!B2:E,Other!A2:A=TRUE)}
You can combine these formulas with an array:
={
FILTER(Produce!B2:E,Produce!A2:A=TRUE);
FILTER(Diary!B2:E,Dairy!A2:A=TRUE);
FILTER(Snacks!B2:E,Snacks!A2:A=TRUE);
FILTER(Household!B2:E,Household!A2:A=TRUE);
FILTER(Other!B2:E,Other!A2:A=TRUE)
}
The semicolon ; at the end of each formula shows that you want the next one to be placed in the next row. Using a comma , instead would show that you want the next item to be placed in the next column.
The above formula should be able to be copied directly into your sheet. Please let me know if you have any issues with this
or try:
=FILTER({Produce!B2:E; Diary!B2:E; Snacks!B2:E; Household!B2:E; Other!B2:E};
{Produce!A2:A; Diary!A2:A; Snacks!A2:A; Household!A2:A; Other!A2:A}=TRUE)

How to combine content from several tables into one?

this is the first time I'm posting here.
I'm trying to make a spreadsheet for my work on Google Sheets and I want to make a table with all the information from 5 other tables without having to copy and paste it.
I have 5 tables, all of them have the same number of columns and the same type of data in each column.
I need to make a new table that shows all the data from all the tables in one.
To make it simpler let's suppose I have 3 tables A, B and C
Each of the tables are like this:
Table A:
DATE|DESCRIPTION|PRICE
1/10|AAAAAAAAAAA|10000
2/10|BBBBBBBBBBB|20000
3/10|CCCCCCCCCCC|30000
Table B:
DATE|DESCRIPTION|PRICE
4/10|DDDDDDDDDDD|40000
5/10|EEEEEEEEEEE|50000
6/10|FFFFFFFFFFF|60000
Table C:
DATE|DESCRIPTION|PRICE
7/10|GGGGGGGGGGG|70000
8/10|HHHHHHHHHHH|80000
9/10|IIIIIIIIIII|90000
I would like to make a table D with the information from tables A, B and C like this:
Table D:
DATE|DESCRIPTION|PRICE
1/10|AAAAAAAAAAA|10000
2/10|BBBBBBBBBBB|20000
3/10|CCCCCCCCCCC|30000
4/10|DDDDDDDDDDD|40000
5/10|EEEEEEEEEEE|50000
6/10|FFFFFFFFFFF|60000
7/10|GGGGGGGGGGG|70000
8/10|HHHHHHHHHHH|80000
9/10|IIIIIIIIIII|90000
Also if I add one more row in any of the tables I want table D to update as well automatically either by adding the new row at the end or in another position... It doesnt really matter as long as it appears in table D.
How can I do this with a formula without having to copy and paste it?
Thank you so much!
Use query() with an { array expression }, like this:
=query(
{
Sheet1!A1:C;
Sheet2!A2:C;
Sheet3!A2:C
},
"where Col1 is not null",
1
)
You can use query for that
=QUERY({Sheet1!A2:C; Sheet2!A2:C; Sheet3!A2:C},"Select * where Col1 is not Null",0)
Please note while combining array, make sure to use similar range reference, that means row and column size of each array reference should be same otherwise it will throw Reference Error
Reference
Query

How can I combine multiple columns into one column in Google Sheets?

(Note: Please simply look at the Google sheet for the quickest understanding of what I'm describing in the below bulletpoints)
My data has rows which each represent an order
Each order (row) can consist of multiple products
For each product in an order (row) there is another set of columns in the same row
I need this data to convert into only one set of columns per row (i.e. one product per row)
The products (new rows) need to remain next to eachother so the columns can't just be added to the bottom of the array (which is more simple)
Can you please take a look at the example below and help me achieve this?
Example Sheet
Screenshot of linked sheet
Try this in another sheet
=SORT({query({Reference!$A5:$A,Reference!B5:F},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!G5:K},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!L5:P},"select * where Col2 is not null ")})

Data not moving with importrange

I have imported some data into columns A-D using QUERY and IMPORTRANGE which is sorted asc by column A (Last name). I then want to manually add data into columns E-P. However as the original sheet is updated with new users and those new people are added to my spreadsheet, my manual data stays where it is and then belongs to the wrong person.
So if someone is added with the last name that starts with A, all the names are shifted down a row, but all the data stays in the original row. So Mr. A was added to row 2 with Mr. B's data instead of a blank row.
Is there a way to tie the data together?
This is my current function:
=QUERY(ImportRange("Sheet ID","Sheet!A:F"),"Select Col1, Col2, Col6, Col5 Where Col1<>'' and Col6 contains 'Qualifiers' Order by Col1 asc")
I want columns E-P of the new names that are added by the importrange to be blank and all the data in columns E-P to be shifted down with every person.
this is standard behaviour of Google Sheets. to counter displacement of data across rows you are supposed to implement a simple ID system and use VLOOKUP to bring up the right data for the right rows.
where Tab A!A:B will be your QUERY and Tab B!B1:B will be your E-P data and ID is the link in between harnessed by VLOOKUP formula. also you will need to change 2 to {2,3,4,5,6,7,8,9,10,11,12} coz having 2 will return you only the first ("E") column

Resources