Google Sheets - Add seperate columns and show sum on another sheet - google-sheets

Ok. Here's my problem. I have a sheet that is created by a Google Form. It is formated like this...
This is part of an INVENTORY CONTROL. This sheet is showing the INCOMING stock. What I want to do is ADD each column (that could go infinately) for example Col B SVHD-01-8OZCUP and display that number on G2 on the sheet below. I also have another sheet that is basically the same showing OUTGOING stock and the sum of its columns would go in H below.
Then I just Subtract H from G in each row to get the Current Inventory. All I need help on is getting the Check-In Totals and Check-Out Totals from the above sheet onto the below sheet. Thanks.

UPDATE 2:
Making the SEQUENCE part of the formula dynamic as per the discussion in comments:
=ArrayFormula(IFNA(VLOOKUP("sum "&A2:A, TRANSPOSE(QUERY({'Re-Order'!A1:DF}, "select "&TEXTJOIN(", ", 1, ("sum(Col"&SEQUENCE((COUNTA('Re-Order'!1:1)-1), 1, 2)&")"))&"", 1)), 2, 0)))
This will only work if you do not have empty columns in the sheet.
UPDATE:
Added this formula in D2 in your Test B sheet:
=ArrayFormula(IFNA(VLOOKUP("sum "&A2:A, TRANSPOSE(QUERY({'Re-Order'!A1:DF}, "select "&TEXTJOIN(", ", 1, ("sum(Col"&SEQUENCE(109, 1, 2)&")"))&"", 1)), 2, 0))) and it seems to be working. Let me know if you have any questions.
PREVIOUS ANSWER:
Based on the screenshots that you have shared (I have not looked at the sheet in the comments) one way to do it is to sum all columns individually in the form and then lookup the value against the product in the second sheet (screenshot 2 of your question)
You can use the following formula in G2 in your the sheet in screenshot 2 of your question:
=ArrayFormula(VLOOKUP("sum "&A2:A, TRANSPOSE(QUERY({inventory_control_sheet_nameA1:DF}, "select "&TEXTJOIN(", ", 1, ("sum(Col"&SEQUENCE(109, 1, 2)&")"))&"", 1)), 2, 0))
This assumes that the input has columns through DF.

Related

Formula that fill a sheet if the data from another are being populated based on a criteria

I'm going to be as clear as possible.
First of all I have 2 sheets:
Sheet 1: https://docs.google.com/spreadsheets/d/1AXPQyw_yZUfafjWNW82Rf9E02qR_0c_SYeKOnqQUUdE/edit?usp=sharing
Sheet 2:https://docs.google.com/spreadsheets/d/1v_AyqHXJVhzRNbL-yGoMLxnuKC3z67tZOcQAWwduCN0/edit?usp=sharing
Thank you for your help,
I'm feeling data in Sheet 1 for each week. In the example, I have week 49 and 50.
In Sheet 2, I have a tab for each week. I'd like to have a formula that based on the week number either from the tab name or from the cell A2 in my example, the formula check Sheet 1, look if there is some entries for the week in question and fill automatically the proper tab for the week.
Try this:
=QUERY(IMPORTRANGE("url";"Sheet1A1:E");"select * where Col1 matches '"&A2&"'");
I haven't tested it because the files are shared as Viewand I think that it at least puts you in the right direction.
References
IMPORTRANGE()
QUERY()
try:
=QUERY(REDUCE({""\""\""\""}; SEQUENCE(2; 1; 49); LAMBDA(y; x; {y;
IFERROR(IMPORTRANGE("1v_AyqHXJVhzRNbL-yGoMLxnuKC3z67tZOcQAWwduCN0";
x&"!A3:D100"); {""\""\""\""})})); "where Col1 is not null"; )
see: https://stackoverflow.com/a/74280310/5632629
and: https://stackoverflow.com/a/74483215/5632629

Formula to get next instance of row that contains specific text that works in ARRAYFORMULA

I'm building out a time tracking form and sheet.
I have everything working and I am able to get the next instance of a row that contains that user's name to get the elapsed time they were in that status.
The formula I am currently using is this:
=ArrayFormula(iferror(INDEX($A2:$A,SMALL(IF(B2=$B3:$B,ROW($B$2:$B)),1)), NOW()))
However, this does not work in an ARRAYFORMULA.
I've tried:
=ARRAYFORMULA(VLOOKUP(B2:B, {INDIRECT("B"&ROW(A2:A)+1&":B"), INDIRECT("A"&ROW(A2:A)+1&":A")}, 2, FALSE))
Which doesn't work in array formula because of INDIRECT.
=ARRAYFORMULA(SORTN(FILTER(A3:A, B3:B=B2), 1))
Doesn't work in ARRAYFORMULA
=ARRAYFORMULA(QUERY(A3:C, "SELECT MIN(A) WHERE B = '"&$B2&"' label MIN(A) ''"))
Doesn't work in ARRAYFORMULA.
These formulas all work if I drag them down manually but I don't want to have to open this sheet every couple of hours to drag it down.
Please help!
Link to sheet where I've been messing with formulas:
https://docs.google.com/spreadsheets/d/1ZZOFTFlhmanQPNfRreT2bBinlkb00uaK-qypmEMD3ww/edit
count it:
=ARRAYFORMULA(IF(B2:B="",,IFNA(VLOOKUP(
B2:B&COUNTIFS(B2:B, B2:B, ROW(B2:B), "<="&ROW(B2:B)),
{B2:B&COUNTIFS(B2:B, B2:B, ROW(B2:B), "<="&ROW(B2:B))-1, A2:A}, 2, 0), NOW())))

Query dated expenses, aggregate and sum by months and by cagetories

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:

Google sheets, how to create a table of Vlookup and get the last occurrence for each customer

I have a database of customers, where his zone, seller and some other values can change, and I want to generate a table of the last occurrence of each one
Heres a demo sheet
using Vlookup doesn't get the last occurrence
My database is very big and I need something to not slow my sheet that much, because I was using a formula like this one for each cell
=ARRAYFORMULA(LOOKUP(2,1/(C2:C=A2),$D$2:$D))
but the sheet is very slow because of this
Any help on this please ?
use:
=ARRAY_CONSTRAIN(SORTN(SORT({C3:E, B3:B}, 4, 0), 9^9, 2, 1, 1), 9^9, 3)

Add another column to merged import range, showing which sheet the row came from

I am trying to import ranges from two sheets, merge and sort them with the following, which is working with formula:
=sort(
arrayformula({
importrange("1qddSA1ec6SqoUorIVa4fVOtYoImiCVm-bZj0ug3czk8","CLIENT DATA!A2:B");
importrange("1Q_eMaSefvcZFwgozBjAE8dGyEseJ4CUed1yxa98Gxzs","CLIENT DATA!A2:B")
}),
1,
True
)
Now what I'd like to do is have a third column in my sheet which will show which sheet the data comes from. Eg. if the row comes from the first sheet it will show "Sheet1" and if the row comes from the second sheet it will show "Sheet2" in column C.
Any ideas how to do this?
You can add the below ARRAYFORMULA to Column C. It uses the MATCH operator to look if the value in each Column B cell exist in Sheets 1 & 2. If yes, it prints Sheet 1 or Sheet 2 respectively, if no it remains empty...
=ARRAYFORMULA(IF(B:B="","", IFS(
IFERROR(MATCH(B:B, {Sheet1!+Column}, 0),""),"Sheet 1",
IFERROR(match(B:B, {Sheet2!+Column}, 0),""),"Sheet 2"
))
)

Resources