Hi! In the 11:00 minute the log returns the value 0.0. I can understand that why the lookupRangeValues.indexOf(lookupValue) returns something like false ( in this case 0.0), but than you add 1 to it , so why isn't it returns 1.0? Could you help me with that? Thank you for your answer in advance.
Question, I want to use the same idea but instead of search in what column, I need what row. the problem is that the values are arrays inside of singles arrays. I want to find the name: "John" and the …getRange(2, 2, lr, 1).getValues(); –> is [ [Carlos], [Mike], [John], [Tom]… ]
I do not know why when we look by columns the values are simple as an array inside of and array, any tricks?
for now I a using Match function in the sheet and then I get the value to the scrip.
The log says "Undefined". Can you help me what's wrong with my script, @Learn Google Spreadsheets? As note: I have "Sheet1" and "Sheet2", and the column "Alfa", "Beta", Gamma".
Here is my script:
function myFunction(){ var index = ColumnIndex("Sheet1","Beta"); Logger.log(index); }
function ColumnIndex(sheetname,columnlabel){ var activeSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetname); var lastColumnIndex = activeSheet.getLastColumn(); var headers = activeSheet.getRange(1, 1, 1, lastColumnIndex).getValues()[0]; var columnIndex = headers.indexOf(columnlabel)+1; }
Hi LCS, Thanks for this video. Can you please help me out with an issue I am facing? My range is a single column. when i am cheking the logs, I am getting only the 1st element of the column.
var arr2 = ss.getRange(2,1,r-1,1).getValues()[0]; Logger.log(arr2);
result = [Dog] (complete contents of the column -> Dog, Cat, Deer, Mouse, Dog)
10 responses to “Match Function with Google Sheets Apps Script -JavaScript IndexOf Method Tutorial – Part 16”
You are doing a great job. Keep it up and thank you.
Great vidéo, thank you so much!
Hi! In the 11:00 minute the log returns the value 0.0.
I can understand that why the lookupRangeValues.indexOf(lookupValue) returns something like false ( in this case 0.0), but than you add 1 to it , so why isn't it returns 1.0?
Could you help me with that? Thank you for your answer in advance.
thankz for this great video bro….
how can I execute script with a key like the enter ? Excelent … God Bless You.
Question, I want to use the same idea but instead of search in what column, I need what row. the problem is that the values are arrays inside of singles arrays. I want to find the name: "John" and the …getRange(2, 2, lr, 1).getValues(); –> is [ [Carlos], [Mike], [John], [Tom]… ]
I do not know why when we look by columns the values are simple as an array inside of and array, any tricks?
for now I a using Match function in the sheet and then I get the value to the scrip.
Regards
CW
The log says "Undefined". Can you help me what's wrong with my script, @Learn Google Spreadsheets?
As note: I have "Sheet1" and "Sheet2", and the column "Alfa", "Beta", Gamma".
Here is my script:
function myFunction(){
var index = ColumnIndex("Sheet1","Beta");
Logger.log(index);
}
function ColumnIndex(sheetname,columnlabel){
var activeSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetname);
var lastColumnIndex = activeSheet.getLastColumn();
var headers = activeSheet.getRange(1, 1, 1, lastColumnIndex).getValues()[0];
var columnIndex = headers.indexOf(columnlabel)+1;
}
Nice one! Thanks! Wondering if I can make this work with data in a single column and match values on multiple rows?
Hi LCS, Thanks for this video. Can you please help me out with an issue I am facing? My range is a single column. when i am cheking the logs, I am getting only the 1st element of the column.
var arr2 = ss.getRange(2,1,r-1,1).getValues()[0];
Logger.log(arr2);
result = [Dog] (complete contents of the column -> Dog, Cat, Deer, Mouse, Dog)
Thanks
Welcome back 🙂 and thanx for another great video