INDIRECT() seemed easy for tiny formulas but it didnt seem that easy for the below formula. The reason I want to freeze is whenever I delete the rows in FormResponses, the formula in the second tab is going haywire.
So watevr happens in FormResponses, I want the formula to be rock steady.
=SUM(ArrayFormula(('Form Responses 1'!$B$2:$B=A2)*('Form Responses 1'!$A$2:$A)*(if(offset('Form Responses 1'!$B$2:$B,0,1)="Break Start", -1, 1))))
SAMPLE SHEET _ TAKE COPY
Unfortunately there is no way to lock just the formatting of a sheet or range. If they are locked it will prevent everything from being changed. Best bet for this would be to create a copy of the sheet, format it how you would like, and protect it from everybody.
Then there are a couple of options:
Go to the protected sheet, select all of the cells, and use format painter to copy the format to the working sheet.
Write a script to copy the format of the protected sheet to the working sheet.
Another option would be to write a script to set the format of sheet. This can be setup to happen when the sheet is opened, edited or when you manually run the script.
Or
To keep some of your data in the same place, you can freeze rows and columns:
Open a spreadsheet and select a cell in a row or column you want to freeze .
Open the View menu.
Hover over Freeze.
Select one of the options to freeze up to ten rows, or five columns. You can also choose Up to current row (or Up to current column) to freeze the rows or columns before a cell you've highlighted.
Related
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:
(Please note: JavaScript, Stack Overflow posting, & Google Script novice)
THE BACKGROUND: I'm attempting to use a Google Sheet Email Notification Add On to trigger notifications when a specific value is seen in a Google Sheet. The config requirements of the add on look for a TextValue, however it has trouble finding the value in a pivot table (where my data is sorted). I've tried moving the data to another sheet with a QUERY formula, however the resultant value is not seen by the add on as a TextValue but rather a cell formula.
My workaround to this is to use a script to copy & paste the data from my pivot to a separate sheet. I used this post as my guide to create my script. It works, however because it pastes all column values at once, the add on is having trouble identifying the trigger TextValue.
THE QUESTION: instead of having the entire column copied and pasted at once, how can I tweak this script to copy and paste a row at a time with a slight delay (1-2 seconds)? This delay will allow the add on to see the the target TextValue and execute the notification (I've tested this manually and it works as expected). Any help in modifying this script (or completely changing the logic if necessary) would be greatly appreciated!!
//Copy contents of inventory column daily to run notification add on
function readInventoryNum() {
var sheetFrom = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Inventory Totals");
var sheetTo = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Testing123");
// Copy from 2nd row, 7th column, all rows for one column
var valuesToCopy = sheetFrom.getRange(2, 7, sheetFrom.getLastRow(), 1).getValues();
//Paste to another sheet from first cell onwards
sheetTo.getRange(1,sheetTo.getLastColumn()+1,valuesToCopy.length,1).setValues(valuesToCopy);
}
When in Google Spreadsheet, you have formula's referencing cells to make for example a simple sum, Spreadsheets will automatically update the references, should the cells be moved. For example if the cells where cut and pasted to a different location, or rows/columns where added somewhere.
I've got this Spreadsheet where I refresh some data in using REST API's in the Spreadsheet script editor. This one runs every 5 minutes or so. However if the cells in which the data needs to be inserted, move around, my script breaks. So I have a list of constants with all kinds of cell names, for example:
/* --- EXCHANGE RATES --- */
var CELL_BTC_EUR = "B3";
var CELL_ETH_EUR = "B4";
var CELL_BNK_EUR = "B5";
But I need to update these every time I move something to optimize the spreadsheet. Is there a way to hard link it to a specific cell so that they automatically update similar to in cell formula's? Maybe not with these constant but with lines like:
sheet.getRange(CELL_BTC_EUR).setValue(btceur.last);
Potential solution
I make a seperate sheet with all my "dynamic" data which is refreshed via Spreadsheet script. In my main sheet, I can reference those cells. Thus if in my mainsheet things start moving, the reference to my other sheet stay the same. I can then hide/protect the Script Sheet.
I'm still gonna make a small table in my mainsheet with my currency exchange rates, just to get an overview of everything. But my references would not break anymore everytime I insert a new coin or something.
(better solutions are welcome. :) )
I'm using Kimono to scrape a site that lists active development permits. For a one off data scrape it's fine, the problem is that there is no way of sorting new data. Every time Kimono scrapes it updates the entire array.
This is what the sheet currently looks like
https://docs.google.com/spreadsheets/d/1BH8ESAHQJrog6x8nRBOpgBN-nTN1_aDY7wr8W_YYet0/edit#gid=1865015934
The first sheet is automatically populated and overwritten by Kimono. It seems like the most logical way of making this work would be to copy the values to another sheet, adding a time stamp when this happens and then preventing duplicate values from being posted.
Following this thread is was able to muster this code
I've got the copying part down with the following:
function moveValuesOnly() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var source = ss.getRange('Building Permits!A1:D');
source.copyTo(ss.getRange('Sheet2!A1'), {contentsOnly: true});
source.clear();
}
What I am trying to figure out is how to prevent duplicates based on the URL value.
I know that it is right in front of me, but I'm drawing a blank on how to get this to work.
This Google documentation article on removing duplicates is very well written, so I won't duplicate it: https://developers.google.com/apps-script/articles/removing_duplicates
It has exactly what you need. Read the later part of the article where it talks about how to check duplicates not for the entire row, but specific columns in that row. Once you understand that, your problem is straightforward to solve. Just use 2 arrays, to hold the contents of the rows from the 2 sheets as in the example they've given. compare the first column value of the current row. if it matches, don't copy the row over.
note: this works only when you copy row-by-row into the target sheet, not the entire range as your'e doing right now. But that's unavoidable.
I've been working on a script (With some help from folk on SO). I have managed to create a script that imports a csv file and updates named ranges based on the imported data.
Here is an image of what I'm trying to do:
At this point I have imported data which has been populated into columns A:G. The cells in columns H:L are formula and are based on the data in A:G. Because I have imported data the data are now longer than the formula range. If not relying on script I would just double click the small blue square at the bottom right of the highlighted cells and the formulas would copy down. This is what I'd like to have the script do once I have imported the data.
I created a range called "formula_range" which automatically updates with the length of data. "formula_range" starts in cell H3 and ends in L:N where N is the length of rows in the sheet.
"formula_range" therefore contains some populated cells with formula and then blank rows all the way to the bottom of the sheet.
I saw this SO post. So in English, my line of thinking is:
Create a variable formula_range H3:L3 as a range
paste formula_range to every row in formula_range
Voila?
How do I get the variable formula_range if the first row in formula_range will always have the formula to be copied down. Put another way it should be fixed at H3:L3.
I tried this:
var copy_range = ss.getRangeByName("formula_range").getRange(1,5,1);
SpreadsheetApp.getUi().alert(copy_range);
My alert said "undefined" (I really wasn't sure what it would show.)
My line of thinking is not the most efficient since I am going to copy over existing formula. Perhaps there is a better way?
How do I get the first row in a named range formula_range[0]; ?
How can I use script to copy down formula in formula_range?
I think what you're trying to accomplish could be achieved more efficiently with a built-in arrayformula:
https://support.google.com/docs/answer/3093275
Place in H3:
=ARRAYFORMULA(DATE(A3:A,B3:B,1))
for each of your formulas in H through L in row 3 surround them with array formula and extend the arguments with open-ended ranges starting with row 3 as in the above example