Like you, I'm beyond bored and looking for anything to fit into the void that was once filled by baseball. So I decided to build a spreadsheet that would help me simulate the non-existent 2020 baseball season.
I think I've found a script that will help me with this process, but can't get it to work. The sheet I am working on is here if you want to give it a look, but the script I'm trying to run would allow me to push a button and have it use Vlookup to add 1 to a cell in the matching row. For example, if I click the plus button to the left of the Tigers, I would want it to add 1 to their season win total in column K.
Here's what I don't get...I can use the script below to successfully add to a specific cell:
function win1() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var yesCount = ss.getRange("k10");
var yesAdd = yesCount.getValue();
yesCount.setValue(yesAdd+1);
}
...but when I replace "k10" with a (working) Vlookup, I get an error that says "Exception: Range not found (line 3, file "Code")". The script I'm using ends up looking like this:
function win1() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var yesCount = ss.getRange("vlookup(S2,G1:L30,5,FALSE)");
var yesAdd = yesCount.getValue();
yesCount.setValue(yesAdd+1);
}
This is my first shot at writing a script, so any help would be appreciated.
I think I've found a script that will help me with this process, but can't get it to work. The sheet I am working on is here if you want to give it a look, but the script I'm trying to run would allow me to push a button and have it use Vlookup to add 1 to a cell in the matching row. For example, if I click the plus button to the left of the Tigers, I would want it to add 1 to their season win total in column K.
Here's what I don't get...I can use the script below to successfully add to a specific cell:
function win1() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var yesCount = ss.getRange("k10");
var yesAdd = yesCount.getValue();
yesCount.setValue(yesAdd+1);
}
...but when I replace "k10" with a (working) Vlookup, I get an error that says "Exception: Range not found (line 3, file "Code")". The script I'm using ends up looking like this:
function win1() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var yesCount = ss.getRange("vlookup(S2,G1:L30,5,FALSE)");
var yesAdd = yesCount.getValue();
yesCount.setValue(yesAdd+1);
}
This is my first shot at writing a script, so any help would be appreciated.