So this is my first time trying to write a script, and the sheet I am working on is here.
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, in my sheet, 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. 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);
}
...however, when I replace "k10" with a 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);
}
As I said, I'm new to this, so any help would be appreciated.