Split up combined Google sheet to separate sheet per person - google-sheets

I've been struggling for a couple of days now how to get this to work. I have a set of data that I get in a CSV format, that I will copy past in a Google Sheets workbook.
On sheet 1 I have the following (example) data:
Hours Expertise Responsible Rate Total
4 Cleaning Bob 11 44
2 Cleaning Barb 15 30
3 Woodwork Xander 19 57
1,5 Electricity Bob 22 33
There are only 3 responsible people in this example, and I now need to create a sheet per person, showing only their data, but in the same way as it is in the combined sheet.
So what I would like to end up with (for this example) are 3 sheets:
Sheet Bob
Hours Expertise Responsible Rate Total
4 Cleaning Bob 11 44
1,5 Electricity Bob 22 33
Sheet Barb
Hours Expertise Responsible Rate Total
2 Cleaning Barb 15 30
Sheet Xander
Hours Expertise Responsible Rate Total
3 Woodwork Xander 19 57
But to be honest, I'm kinda lost right now. I couldn't get this to work with pivot table or any of the other things I could find with google. I also tried using Vlookup, but then I end up with empty lines in between.

use:
=QUERY({'sheet 1'!A:E}, "where Col3 = 'Bob'", 1)
=QUERY({'sheet 1'!A:E}, "where Col3 = 'Barb'", 1)
=QUERY({'sheet 1'!A:E}, "where Col3 = 'Xander'", 1)

Related

Google Sheets collect data from two sheets

I have two sheets.
Sheet1
Name
Price
Boots
30
Dress
10
Jeans
25
Shirt
15
Sneakers
35
Sheet2
Name
Dress/Red
Jeans/Blue
Dress/Black
Shirt/White
Dress/White
I want to collect data to Sheet3 using one formula (unique names that contained in Sheet2):
Sheet3
Name
Price
Dress
10
Jeans
25
Shirt
15
I've tried to make some queries but I don't have enough knowledge. Could you help me please?
try:
=FILTER(A1:B, COUNTIFS(INDEX(SPLIT(D1:D, "/"),,1), A1:A))

How to do a full outer join?

I am trying to do the full join for the data below in two different sheets.
Sheet 9:
Product ID
Name
Quantity
1
addi
55
2
fadi
66
3
sadi
33
Sheet10
Product ID
Variants
Model
1
xyz
2000
2
differ
2001
3
saddd
336
4
fsdfe
2005
Desired output sheet :
Product ID
Name
Quantity
Variants
Model
1
addi
55
xyz
2000
2
fadi
66
differ
2001
3
sadi
33
saddd
336
4
fsdfe
2005
Please also share if we have more columns to join like in sheet 1 and sheet 2 has two more columns like Year, product label etc then what should I change in your proposed solution
I am using this formula but its not returning the desired result
=ARRAYFORMULA({QUERY(SORT(UNIQUE({Sheet9!A1:D; Sheet10!A1:D})), "where Col1 is not null"),IFERROR(VLOOKUP(TRANSPOSE(QUERY(TRANSPOSE(QUERY(SORT(UNIQUE({Sheet9!A1:D; Sheet10!A1:D})), "where Col1 is not null")),,999^99)), TRANSPOSE(QUERY(TRANSPOSE(Sheet9!A1:D),,999^99)), Sheet9!C1:C}, 2, 0),""),IFERROR(VLOOKUP(TRANSPOSE(QUERY(TRANSPOSE(QUERY(SORT(UNIQUE({Sheet9!A1:D; Sheet10!A1:D})), "where Col1 is not null")),,999^99)), {TRANSPOSE(QUERY(TRANSPOSE(Sheet10!A1:D),,999^99)), Sheet10!C1:C}, 2, 0),"")}})
EDITED to consider dynamic row matching.
See this spreadsheet to illustration, but overall there's a question of your setup, but I would break your problem into two steps.
Get distinct list of ID's
You can get that with this formula:
=unique(transpose(split(textjoin(",",true,
iferror(INdex(Sheet2!$A$2:$Z,0,MATCH(A1,Sheet2!1:1,0)),""),
iferror(INdex(Sheet1!$A$2:$Z,0,MATCH(A1,Sheet1!1:1,0)),"")),",")))
Rest of Headers
Then for each header, will they each always only be in 1 exclusively or 2 (not both)? Assuming so, this should work for each additional column. If two values ever exist in the two sheets, will join them in the same column.
=filter(
iferror(VLOOKUP($A$2:$A,Sheet1!$A:$Z,match(E$1,Sheet1!1:1,0),false),"")
&iferror(VLOOKUP($A$2:$A,Sheet2!$A:$Z,match(E$1,Sheet2!1:1,0),false),"")
,$A$2:$A<>"")
There's probably a way to use the join function to do this more elegantly (if someone posts an answer showing me I'll upvote).

How can I rearrange a Google Sheet using the data within the sheet?

I get massive serialized spreadsheets in the following format:
PN SN Qty
1 24 3
2 25 1
3 26 7
I need to write a Sheets script that can rearrange the data so that the headers are gone, and the quantities are extrapolated, then cleared.
For example, the desired result would be:
1 24
1 24
1 24
2 25
3 26
3 26
3 26
3 26
3 26
3 26
3 26
I have tried writing a few recursive statements to achieve this, however once I started adding in new rows to the sheet my loop breaks. I've tried hundreds of different iterations of what I know should be a fairly simple task but alas, I am well out of practice. I fear at this point I am fixated on the wrong idea. Any help in the right direction would be greatly appreciated!
You don't need to use google apps script.
Try the following formula:
={ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(
REPT(A2:A&"♠", C2:C), ,999^99), "♠")))),ARRAYFORMULA(TRIM(TRANSPOSE(SPLIT(QUERY(
REPT(B2:B&"♠", C2:C), ,999^99), "♠"))))}
Different approach, same result:
=ArrayFormula(SPLIT(QUERY(FLATTEN(SPLIT(FILTER(REPT(A2:A&"\"&B2:B&"^",C2:C),A2:A<>""),"^",0,1)),"Select * Where Col1 <>''"),"\"))
I'm adding this only because different people may find one or the other easier to understand and apply. There is no practical or performance gain to this formula over the great suggestion given by Marios.
NOTE: This formula makes use of an as yet unofficial Google Scripts function, FLATTEN.

Querying values from a Google Sheets

I have a table of foods with their nutritional values in a Google Sheets. My objective is to enter portions consumed of each food in a given day and calculate nutritional intake for the day. For each row that has a portion entered, I want to summarize the nutritional values times the number of portions served. I've given a very simplified version below.
Can anyone tell me how to go about doing this in Google Sheets?
PORTIONS FOOD CALORIES FAT PROTEIN
1 beef 250 34 25
chicken 220 22 13
carrots 20 12 23
2 beans 40 25 5
--------------------------------------------
TOTALS 330 84 35
In C6 place:
=sumproduct($A2:$A5,C2:C5)
Then copy across to D6 and E6

Formula to condtionally sum an array of values from one sheet to give totals on another

I have two sheets, connected by ID, which contain details of events and charges.
Sheet1 (breakdown of charges):
[Oh, just discovered I'm not allowed to include screen shots. I apparently need 10 reputation points. Not sure how to show you my spreadsheet now...]
ID DBF PCC Extras
1 200
1 100
3 200
4 350
4 250
4 75
4 25
7 100
[Sorry this will probably look horrible, I can't figure out how to include a spreadseet snippet without using an image. I had 3 imaage all prepared ready.]
Sheet2 (indentification and summary information):
ID Type Name
3 MON Edwards
7 REC Smith
4 WDG Jones
1 FNL West
8 WDG Richards
9 WDG Morrison
11 INT Gray
I am trying to add three additional columns to sheet 2 so that it shows a summary of the charges for each event. I would the charges information to update automatically in sheet2 as detail is added to sheet 1.
The resulting sheet2 will look like this:
ID Type Name DBF PCC Extras
3 MON Edwards 200
7 REC Smith 100
4 WDG Jones 350 250 100
1 FNL West 100 200
8 WDG Richards
9 WDG Morrison
11 INT Gray
As data for ID 8, 9 and 11 is added to sheet1, the summations should automatically appear in sheet2.
I have been trying to create an array formula to put in sheet2:B2, something like this:
=QUERY('Log Items'!A:F, "select sum(C), sum(D), sum(E), sum(F) where A="&A:A, 0)
This produces the correct result for ID 1 but it stops there and I'm not sure why. Also, despite my 0 as the third parameter, the header row is output.
I tried encapsulating the above in an ARRAYFORMULA but get a parse error.
I have also tried various combinations of ARRAYFORMULA, SUM and IF but not got anything that works. For example:
=ARRAYFORMULA(SUM(IF('Log Items'!A:A=A:A,'Log Items'!C:E,0)))
This gives #N/A "argument out of range", which I don't understand.
Although I've been working with Excel for a while, I'm really new to Google's Array formulas but have mananged to use them successfully in other parts of my spreadsheet and found them really powerful.
If anyone could help me with this, I would be very grateful.
In Sheet2!D2:
=ARRAYFORMULA(IF(A2:A,MMULT(N(A2:A=TRANSPOSE('Log Items'!A2:A)),N('Log Items'!B2:D)),))
Note: the N() functions have become necessary with different coercion behaviour in the new version of Sheets. They can be omitted in the classic version.
MMULT usage

Resources