I have an inventory spreadsheet with a 'total stock' list with the names of all ingredients I use, a raw materials sheet, and a batch sheet. Whenever I receive a new raw material (e.g cocoa butter) I log it into the sheet and the stock list updates, even if the names differ (e.g unrefined cocoa butter). The formula I'm using to do this is:
=INDEX(QUERY('Raw Materials'!$B$2:$F$2000,"select sum(F) where B contains '"&$B4&"' label sum(F)'' "),)
When I log a new batch in the batch sheet which contains the ingredient name (colA) and amount used (colB), I would like to have the 'total stock' for that ingredient change accordingly. So, total stock = raw material stock - batches
Is there a way add this to the existing formula so the results are in one cell?
Sample: https://docs.google.com/spreadsheets/d/1aFT_SZ7V6rDMPQPEauCJrWKbAAMRaiZ6RGhhPGdfo8o/edit?usp=sharing
try:
=ARRAYFORMULA(QUERY(QUERY({TRIM('Raw Materials'!B2:B), 'Raw Materials'!F2:F,
IFNA(VLOOKUP(TRIM('Raw Materials'!B2:B), Batches!A:B, 2, 0), 0)},
"select Col1,sum(Col2),Col3 where Col2 is not null group by Col1,Col3"),
"select Col1,Col2-Col3 label Col2-Col3''"))
Related
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)}
In SheetA I've got a set of rows that have a "Rating Of Thing" column.
The rating of thing column assigns ratings that belong to a non-numerical hierarchy. On a separate sheet (SheetB), using a pivot table, I'd like to display certain items in that sheet based on their position in that hierarchy. However, since the "Rating Of Thing" list is non-numerical, I'm getting results like the following.
I'd like to know how to create some sort of "on the go" mapping when the pivot table handles the "Rating of Thing" column so that I can find the max or highest rating for each month and display it in the table.
Link to the live sheet is here
try:
=INDEX(REGEXREPLACE(""&SORTN(SORT({TEXT(MONTH(A2:A&1), "00")&"×"&A2:A, C2:C},
MATCH(C2:C, E2:E5, 0), 1), 9^9, 2, 1, 1), ".*×", ))
community!
I have a table of 3 columns in Google Sheets: Date, Name, Amount.
I want to process data from it, so for every date in the list, there will be a full list of participants and amounts.
If there is no amount for specific date and person, it will be "0", or just leave it blank.
In addition, would like to count the percent of the sum of the amount for each person till the date in the corresponding row.
And it should be dynamically updated, so if a new row added with new name or date or both, so new participant will be added to every date in the output table and new full list of participants for the new date created.
For better understanding, here is the example of the data and output tables
What I've tried?
In MS access query it could be done not so hard.
Here I tried to create 2 new lists of unique dates and participants and connect them through use of CONCATENATE, ARRAYFORMULA, then SPLIT and some QUERY. All this through use of helping column of text, which should be edited manually for every new row...
The code in helping column:
=concatenate(arrayformula(if(isblank($F$3:$F),,";"&$E3&","&$F$3:$F)))
Then split code:
=query(arrayformula(split(transpose(split(TEXTJOIN(";",true,$G$3:$G),";",true,true)),",",true,true)),"Select Col1,Col2 where Col2 is not null order by Col1 ASC",0)
But here I stuck...
Want to pull the amounts for every corresponding date and participant, but...
FILTER reaches first, not existent in the original table combination, and doesn't proceed.
QUERY doesn't fetch the data fully automatically for all the list in the output table.
VLOOKUP gives only one row or complete mess, when use it recursively, or error...
So, how can I do this (if it's possible at all) in google sheets, and so all the output will be fully automatically updated?
Thank you very much!
Update - based on comments
I could not figure out a way to make this through one formula. If this works, you can have a hidden column (say H here) that totals the amount for the person till that date using the formula =QUERY(FILTER($E$3:$G, $F$3:$F = F3, $E$3:$E <= E3), "select sum(Col3) label sum(Col3) ''", 0) in H3.
Then in I3 you can find the % of total till date using the formula =QUERY(FILTER($E$3:$G, $F$3:$F = F3, $E$3:$E <= E3), "select sum(Col3) label sum(Col3) ''", 0)/SUMIF($E$3:$E, E3, $H$3:$H).
Both of the formulae in H3 and I3 need to be dragged down unlike the one in E3. Perhaps someone will be able to offer a better solution.
Previous answer
You can try something like this:
In E3 you can have the formula =ArrayFormula({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), (TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), (COUNTA(UNIQUE(A3:A)))), "◼︎"))), (IFNA(VLOOKUP({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦")))&(TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), (COUNTA(UNIQUE(A3:A)))), "◼︎")))}, {A3:A&B3:B, C3:C}, 2, 0), 0))}). It is a little long but fills Columns E through G dynamically.
Then in H3 you can have the formula =ArrayFormula(IFERROR(((IFNA(VLOOKUP({(FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦")))&(TRANSPOSE(SPLIT(REPT(JOIN("", FILTER(UNIQUE(B3:B)&"◼︎", UNIQUE(B3:B)<>"")), 3), "◼︎")))}, {A3:A&B3:B, C3:C}, 2, 0), 0))/(SUMIF((FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), (FLATTEN(SPLIT(REPT(FILTER(UNIQUE(A3:A)&"✦", UNIQUE(A3:A)>0), COUNTA(UNIQUE(B3:B))), "✦"))), G3:G))), "")). This one is dynamic as well.
I tried with your data and added a row on my own and it works.
I need to extent Google sheets annual budget template.
I'd like to its Expenses sheet to pull and fill data from my detailed "Expense Breakdown" sheet automatically to avoid me filling the data twice.
Here is my table I need to fill in(there are many tables like that)
Here is my detailed expenses list
And here is a test spreadsheet https://docs.google.com/spreadsheets/d/1rk03JI6-JRkaH5eixWJaOU5xwcOl2sVE_fMInOIBZhA/edit?usp=sharing
I tried pivot tables to aggregate dates into month and sum expenses, but for some reason, Google doesn't know how to do it.
So the way I see it, I need to place a formula into each cell in D46 to O53 range, where each cell will query expenses list, aggregate data(sum by category and date) there, then match and pull by date(from D2:O2 cella)and category (in C col). Does that make sense?
Can somebody help me to create a formula for that?
first, you need to fix your logic... every category (column A) needs to have unique sub-category (column C) meaning you cant have sub-category called Other for every category because you would output exact same values of Other sub-category for all categories
then use in D46, D4, D15, D24, etc...
=ARRAYFORMULA(IFNA(VLOOKUP(
INDIRECT(ADDRESS(ROW(), 3)&":"&ADDRESS(IFERROR(MATCH("Monthly totals:",
INDIRECT(ADDRESS(ROW(), 3)&":C"), 0)+ROW()-4, ROWS(A:A)), 3)),
QUERY({'Expenses Breakdown'!B:F; {VALUE(TEXT(SEQUENCE(12, 1, 0, 29), "m/d/yyy")),
SEQUENCE(12, 3, 0, 0)&"♀", SEQUENCE(12, 1, 0, 0)}},
"select Col3,sum(Col5)
where Col3 matches '"&TEXTJOIN("|", 1, "0♀",
INDIRECT(ADDRESS(ROW(), 3)&":"&ADDRESS(IFERROR(MATCH("Monthly totals:",
INDIRECT(ADDRESS(ROW(), 3)&":C"), 0)+ROW()-4, ROWS(A:A)), 3)))&"'
group by Col3
pivot month(Col1)+1"), COLUMN(B:M), 0)))
also, you may want to disable rounding:
How do I create multiple sheets that use a Google sheet named TOTAL as the data source? Each sheet must contain the same three columns from TOTAL and other specific data, for instance, FLUX will have six columns, three from TOTAL and three custom columns added manually.
I used a query function to import the data from TOTAL to FLUX so that updating data in TOTAL will update it also in FLUX
The data in TOTAL are not fixed. It will change adding rows, which might change the order of the list. For instance, adding the row 13 in TOTAL will shift down the data in column A:C in FLUX, but not columns D:F
Is that a way to keep the reference out of the QUERY part?
Here an example: Click me
you would need to create ID system and then you would be able to match your query with rest of the static columns. in sheet SALES remove that query and put IDs in A column. then your query will be:
=QUERY(TOTAL!A1:D, "SELECT A, B, C, D WHERE C is not null", 1)
where column A contains IDs and then you create new sheet SHEET3 and paste this query in A1
and this formula in E1:
=ARRAYFORMULA(IFERROR(VLOOKUP(A1:A, SALES!A1:G, {4,5,6}, 0), ))
I have the same problem and I can't understand few steps from the answer.
Firstly, the A columns of both sheets (TOTAL and SALES) must have IDs?
Secondly, I can't really understand how the Sheets SALES should look like. Should it be like, Col A = IDs, ColB to C query from TOTAL and Col E to G static data?
In this case is it still correct creating a query in Sheet3 reading data from TOTAL?
Thank