How can I make this Google Sheets scheduling system work? - google-sheets

I am creating a scheduling system for my company. I have tried this a few ways and I am not getting anywhere. I need the corresponding date that an employee is off to show "TRUE". Since I am using VLOOKUP for this, I am only getting the first value. I am using the following formula in cell F2.
=arrayformula(ifna(if(vlookup($E2:$E62,$A$2:$C$15,2,false)=F$1:L1,true,""),""))
I have highlighted the issue. Can someone take a look at this and point me in the right direction?
Sample spreadsheet: https://docs.google.com/spreadsheets/d/1e7b2aiGRH9Mm2mB2A_d4uavXQeCKrW3vXgMcnYtAfRM/edit#gid=0

use in F2:
=ARRAYFORMULA(IF(ISNUMBER(IFNA(VLOOKUP(E2:E, QUERY(QUERY({A2:B},
"select Col1,max(Col1) where Col2 is not null group by Col1 pivot Col2"),
"select Col1,Col3,Col5,Col4,Col2"), {2, 3, 4, 5}, 0))), TRUE, ))

Related

How to sum results obtained with VLOOKUP and IMPORTRANGE in Google Sheets?

I'm currently obtaining the result with the formula below, which was nicely provided by player0, but the challenge now is to obtain not only the figure found, but a sum, since the occurrences in the "database" may be multiple.
=Arrayformula(if(A9:A="";;IFNA(vlookup(A9:A&D9:D&"Expedição"&"Costura";
{IMPORTRANGE("fileId";"Produção!F2:F")&
IMPORTRANGE("fileId-1n3nQ";"Produção!H2:H")&
IMPORTRANGE("fileId-1n3nQ";"Produção!R2:R")&
IMPORTRANGE("fileId-1n3nQ";"Produção!B2:B")\
IMPORTRANGE("fileId-1n3nQ";"Produção!N2:N")};2;0))))
I have tried including sum in many places in the formula above, but with no success.
Here's a file with dummy data.
Thanks in advance.
use:
=ARRAYFORMULA(IF(A4:A="",,IFNA(VLOOKUP(A4:A&" "&C4:C&" Expedição Costura ",
QUERY(SPLIT(FLATTEN(QUERY(TRANSPOSE(QUERY({IMPORTRANGE(
"1gh5w0czg2JuoA3i5wPu8_eOpC4Q4TXIRhmUrg53nKMU", "Data Origin!A2:R")},
"select Col6,Col8,Col18,Col2,'×',Col14 where Col14>0 label '×'''", )),,9^9)), "×"),
"select Col1,sum(Col2) where Col2>0 group by Col1"), 2, 0))))

Update certain cells from another Sheets according to a criteria in Google spreadsheets

I'm creating a Budget calculator spreadsheet in Google Drive, I'm trying to update cells from another Sheet with certain criteria:
This is Sheet1:
According to the date and category should update a cell from another Sheet in the same document, with the quantity.
This is Sheet2:
I'm not sure If I'm able to implement this flow in the same Google spreadsheets or if I should use Python instead. I tried everything and I'm stuck here. If someone could give me a hint about it I'll appreciate it a lot.
Here's the link to the spreadsheet: https://docs.google.com/spreadsheets/d/1BEtKJGVOdVF8PLxcR_96cPjE_4XH0QFbtV9dynroly0/edit?usp=sharing
try this cobra query in B13:
=INDEX(IFNA(VLOOKUP(A13:A21, QUERY({Sheet2!A3:D;
TO_DATE(SEQUENCE(12, 1, 2, 33)), 0/SEQUENCE(12, 3,,)},
"select Col2,sum(Col4)
where Col2 is not null
group by Col2
pivot month(Col1)-1"), SEQUENCE(1, 12, 2), )))

Selecting nth value based on set of cells Google Sheets

I have a set of ID's to compare to a SDE, and I would like to pull multiple rows from the SDE using the ID's as a reference. The reason I want to lookup nth instances is because I have multiple columns in which each column will pull a different instance so all the data can be store horizontally instead of vertically. There will be more ID's but the two on there are just for testing purposes.
The current function I have is =ARRAYFORMULA(IF(C4:C="",,INDEX(SDE_materials_mat,SMALL(IF(C4:C=SDE_materials_id,ROW(SDE_materials_mat)),1))))
That function displays the following alarm:
Array arguments to EQ are of different size.
Here is a copy of the sheet:
https://docs.google.com/spreadsheets/d/1uPgFYKjfkcLfBTAcuPL__gDYeCmn1Nwu473CFMepaUk/edit?usp=sharing
Thank you in advance for any help, it's very appreciated!
try:
=ARRAYFORMULA(IFERROR(SPLIT(IFNA(VLOOKUP(C4:C, SPLIT(FLATTEN(QUERY(QUERY(FILTER(
{SDE_invTypeMaterials!B2:B&"¤"&SDE_invTypeMaterials!C2:C, SDE_invTypeMaterials!A2:A&"×"},
REGEXMATCH(SDE_invTypeMaterials!A2:A&"", TEXTJOIN("|", 1, C4:C)),
COUNTIFS(SDE_invTypeMaterials!A2:A, SDE_invTypeMaterials!A2:A,
ROW(SDE_invTypeMaterials!A2:A), "<="&ROW(SDE_invTypeMaterials!A2:A))<7),
"select max(Col1) where Col1 is not null group by Col1 pivot Col2"),,9^9)), "×"), 2, 0)), "¤ ", 1)))

Google Sheets Query / Array

I'm trying to build a very simple inventory sheet. Apologies in advance, but I'm very new at this.
a) I'd like my inventory sheet to show stock for individual items, and for kits (BOMs)
b) I'd also like the array formula to update depending on an adjacent column value (i.e. if the row shows 'fulfilled' then the array should ignore it.
I have been able to modify an old post that I found here, but unfortunately the original document was modified. https://support.google.com/docs/thread/23230245?hl=en
Does anyone have access to that original doc? I know Matt King was involved.
Does anyone know of a beginner's guide to Google Sheets Query / Array formulas?
I know I'm speaking in gibberish, but believe me I'm fascinated with this and I'm a quick learner. Would also be interested in paid coaching if anyone's into that!
https://docs.google.com/spreadsheets/d/1btnxxI00qI9njIUzudAZXh4G87TWcHoWtfPl4jBl7jM/edit?usp=sharing
={"Units"; ArrayFormula(IFNA(VLOOKUP(B2:B, QUERY({'BOM Import'!F2:I},
"select Col1,sum(Col4)
where Col4 is not null
group by Col1
label sum(Col4)''"), 2, 0)))}
={"Total Stock on Hand"; ArrayFormula(IF("yes"=IFNA(VLOOKUP(IFNA(VLOOKUP(B2:B, {'BOM Import'!F2:F, 'BOM Import'!E2:E}, 2, 0)), SORTN(SORT({'Kits Requested'!B2:B, 'Kits Requested'!A2:D}, 2, 0), 9^9, 2, 3, 1), 5, 0)), 0,
IFNA(VLOOKUP(B2:B, QUERY({'BOM Import'!F2:J}, "select Col1,sum(Col5) where Col5 is not null group by Col1 label sum(Col5)''"), 2, 0))))}

Marrying Query and Arrayformula through cell reference in Google Sheets

Trying to understand if it is possible to apply ARRAYFORMULA to situations when QUERY is used in Google Sheets.
For example, I used QUERY for querying and aggregating a set of items, like so:
=QUERY($H$2:$I$17,"select sum(I) where H='"&A2&"' label sum(I) ''",0)
But in order to make that work across the spreadsheet, I will have to drag this formula down. There is also the ARRAYFORMULA thing, which is supposed to help with getting rid of excessive dragging, however it does not seem to work with QUERY, or am I just missing something?
A picture for a quick look:
And a shared file for the longer thinking:
https://docs.google.com/spreadsheets/d/1xOdqeESrFbrBknNYahSeF0ripA5fr2vVFQ-r--lkdA0/edit?usp=sharing
use this formula:
=QUERY(H2:I17, "select H,sum(I) where H is not null group by H label sum(I)''", 0)
and then you can do simple VLOOKUP like:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, QUERY(H2:I17,
"select H,sum(I) where H is not null group by H label sum(I)''", 0), 2, 0)))
Here two method alternatively:
first ==>
=arrayformula(sumif(H2:H,"=" & unique(filter(H2:H,H2:H<>"")),I2:I))
second ==>
=arrayformula(
query(
filter({vlookup(H2:H,{A2:A,row(A2:A)},2,false),H2:I},H2:H<>"")
,"Select sum(Col3) group by Col1 label Sum(Col3) ''"
)
)

Resources