G-Sheet Function support to Match Date, name and Other Point - function

Its Pleasurer if you can support me to write function to preform google sheet.
https://docs.google.com/spreadsheets/d/1uwbFcdkN3VHkzpHyx73LSTbPwltZrH5R_n7jsLe-iuU/edit?usp=sharing
Solution starting from cell D7 (D7:AH14)
Need to Factors
For Sheet Working Indika -
Date row 6,
Facility Column C
Plan or Actual - Cell F3 (F3:J3)
Need to Capture Information from Sheet Facility Schedule
Date - Row 2
Facility Column B
Plan or Actual - Column C
Best regard
Indika

let me know if this is useful:
In D7 use this formula and copy then to the entire range:
=index('Facility Schedule'!$1:$962,match($C7,'Facility Schedule'!$B$1:$B$18,0)+if($F$3="Actual",1,0),match(D$6,'Facility Schedule'!$2:$2,0))
Here I upload a picture of your own spreadsheet with Plan and Actual displayed:
Look how Facility A changes (which is the only one different by now)

Related

Google Apps Script - When new row containing data with specific keywords is added to Sheet 1, move that to a new row in a new corresponding sheet

I am using Google Sheets to evaluate data from a Zoho Form. I would like to sort the raw data from spreadsheet 1 ('Raw Data') into 3 new spreadsheets depending on 2 specific keywords found in 2 different columns in 'Raw Data'.
For context - the keywords for the first column (column 'G') are:
Ordered
Stock
Preordered
the keywords for the second column (column 'F') are:
B2B
B2C
There are a total of 6 possibilites that need to be accounted for: ordered & B2B, ordered & B2C, stock & B2B, stock & B2C, preordered & B2B, preordered & B2C.
If for instance a form is submitted for 'Ordered' and 'B2B', then a specific succession of rows must be transferred to the corresponding 'Ordered' spreadsheet because of Zoho Forms' nature of staggering the submitted information horizontally in the 'Raw Data' sheet. These rows will change depending on which one of the 6 combinations is chosen in the Form.
The 3 new spreadsheets will be named according to the keywords found in column 'G'.
So far I have been working with a Query in the new sheets to pull the needed information from the 'Raw Data' spreadsheet, however this hasn't proven to work as intended as Zoho Forms creates a new row rather than filling an existing one, causing the query to skip the newly created row and therefore not pulling any data.
Here is the Query, maybe it'll help identify what I am looking for:
=IF('Raw Data'!G6="Ordered", IF('Raw Data'!F6="B2B",QUERY('Raw Data'!A6:DN6,"SELECT A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T ORDER BY C desc LIMIT 1"), QUERY('Raw Data'!A6:DN6,"SELECT A,B,C,D,E,F,G,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU ORDER BY C desc LIMIT 1")))
I have found someone who posted a Script similar to what I am looking for, however it is missing that conditional aspect to it. Here is the script, maybe it can serve as a good starting point. (all credit for this code goes to Mike Steelson):
function moveData() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
var rng = ss.getSheetByName('Sheet1').getRange('A2:C2')
ss.getSheetByName('Sheet2').getRange(ss.getSheetByName('Sheet2').getLastRow()+1,1,1,3).setValues(rng.getValues())
rng.clearContent()
}
I am quite new to building these sort of things so please forgive me if the Query and my overall explanation isn't the best, if you have any questions I'll try my best to elaborate!
Cheers,
Rupert.

Copy Adjacent Cells alongside Duplicate Cells

I have a very large Google Sheet spreadsheet that I need help with.
I have a long list of Network Switches that are very often repeated that I am trying to automatically copy the associated SKU into a separate adjacent cell.
My goal was, once the SKU is added the first time, whenever the same switch is added again, it will autopopulate with the same SKU.
For instance, C2461:C2463 are repeated, and once K2461 is populated, would like K2462 & K2463 to follow suit.
Any help would be greatly appreciated!
You can try this formula on Column L (col L will serve as a helper column):
=iferror(arrayformula(VLOOKUP(C2:C,C2:K,9,False)),"")
For now I can't seem to fit the formula without the use of a helper column (so I created a separate sheet for now that will serve as a database for the VLOOKUP formula) but this should get you started.
Sample using a helper spreadsheet (Database):
=iferror(arrayformula(VLOOKUP(Database!A2:A,Database!A2:B,2,False)),"")
Output:

Sum by products horizontally into vertical data Google Sheets

I'm using Google Sheets to collect data of daily arrivals of products. My data looks as shown below:
What I'm trying to achieve is a sum by product:
I've tried something with a Script but with not much luck because I'm a little lost. Is there a way to do this through formulas? Or would it be easier using Scripts/Macros?
Thanks for any help you may provide!
This can be done with native google sheet formula's. Change ALL the A1:D3 to your range. Leave out the headers (row 1) and the ID (column A). So start at B2. I don't understand the ID column. Does not seem to do something?
The formula:
=QUERY({
FILTER(FLATTEN(A1:D3),ISTEXT(FLATTEN(A1:D3))),
FILTER(FLATTEN(A1:D3),ISNUMBER(FLATTEN(A1:D3)))},
"SELECT Col1, SUM(Col2) GROUP BY Col1 LABEL Col1 'Products', SUM(Col2) 'KG'",0)
So FLATTEN will create a list like this:
Snack
4
General
6
We filter out all the text and all the number, then this is the input data for the query. TIP: Copy the formula's out the main formula and see what it does.
If I'm understanding your post correctly, you have an ID column followed by 40 columns which alternate "product ... kg ... product ... kg ..." for a total of 41 columns running from A to AO.
I don't know the name of your source-data sheet. So I'll just call it "Source Sheet" in my formula. Change that throughout to your actual source-data sheet name.
You will want this formula in a separate sheet: not the source-data sheet:
=ArrayFormula({"ID","PROD","KG";QUERY(SPLIT(FLATTEN(FILTER('Source Sheet'!A2:A,'Source Sheet'!A2:A<>"")&"|"&FILTER('Source Sheet'!B2:AO,ISEVEN(COLUMN('Source Sheet'!B2:AO2)))&"|"&FILTER('Source Sheet'!B2:AO,ISODD(COLUMN('Source Sheet'!B2:AO2)))),"|",0,0),"Select * Where Col2 Is Not Null")})
Before I invest time explaining how it works, please test it out and report back whether this formula produces the desired result. If so, I'll explain the workings of it.

Get the previous date from employee record with reference for the current date using 2 sheets [Google Sheets]

I have an excel file and need to update them to Google sheets. The problem is I cannot convert the functions in my excel to Google sheets.
Can anyone help me get the correct function for previous date from employee record with reference for the current date using 2 sheets [Google Sheets]
Excel function:
=AGGREGATE(14,6,Sheet2!K:K/(Sheet2!K:K<X2)/(Sheet2!A:A=A2),1)
I have tried QUERY function but I haven't found any examples online that could get the correct result.
From the 1st sheet 'Main Data to LOAD' I need to adjust column 'G' and 'I' it to get result.
Sheet 2 Employee record history used for checking the correct date for the first sheet.
Here is a mock sheet so anyone can try: (Kindly make a copy first for testing, I have an extra copy but just to be safe. Thanks)
https://docs.google.com/spreadsheets/d/16pZgf7igkt27Ep8a94-5t1M8KEW5wxP5uzSdHCNx_k4/edit?usp=sharing
Let me know if more information is needed.
Kind regards,

Keeping value after reference cell has been changed

I need cell B3 to reference B1 while blank.
Once you put something in B1 it'll keep that value forever, even once B1 get's changed to something else.
This is my situation:
Basically I have a sheet that is fed by a Google form and each submission needs three key reference numbers each kept in columns a,b,c
A = Unit Number/Individuals name (There may be duplicates down the sheet as this is per submission)
B = Work Order (Imputed by me after actual work on unit has been done)
C = Cry Number/Reference number (Automatically generated per submission; no duplicates)
I then have a frozen row at the top which contains a search bar that you can search for the cry number (A1)(Which has a Data Validation set to column C so that you can only search valid cry numbers) and then a cell to add a W/O to that Cry Number (B1)
In column B3:1000, I have this formula copied down:
B3=if(isblank($C3),"",if($A$1=$C3, SUBSTITUTE($B$1,"",$B$1),""))
...which makes it so that if you select say "CN-168" (A valid cry number) and in 'B1' type "W1134" that work order number will be assigned.
Now I need that work order to stay there regardless of when 'A1' changes so that you can do the process over again on another submission.
Is it possible to do with formulas? If not, then a Google Script?
Here is a template of what I'm dealing with but not to the same scale as my Data Base
Its not possible with formulas but easily done with apps script. look at the onEdit trigger and the documentation for SpreadsheetApp to setValues to the appropiate ranges.
If you want to be 100% complete you also need a time trigger (say every 10 minutes) to check that a row wasnt missed. It can be missed during apps script errors/outages or when the sheet is changed from outside the sheets webpage/app (For example using the http spreadsheet api)