Match Function with Google Sheets Apps Script -JavaScript IndexOf Method Tutorial - Part 16

  Рет қаралды 67,131

Learn Google Sheets & Excel Spreadsheets

Learn Google Sheets & Excel Spreadsheets

Күн бұрын

Пікірлер: 64
@davidduran2984
@davidduran2984 4 жыл бұрын
This script was as short as it was useful. I was wondering about this for quite a while.
@bh-db2rp
@bh-db2rp 5 жыл бұрын
Hi, this is very interesting. However I ask for a range which is a column and I get a range of values in an array of an array. [[valrow1],[valrow2],[valrow3]] but I cannot find a way for the indexOf function to find my value. I used lookupvalue = "valrow3" or ["valrow3"] or "[valrow3]", none of them work. I am certainly not well versed in the syntax for array and I cannot find an answer. thanks for your help.
@vlth
@vlth 4 жыл бұрын
Great vidéo !! (sorry for my English....) i'm wondering the same script for a row !! u give me the road !!! yessss
@trajanoroberto120
@trajanoroberto120 5 жыл бұрын
another great video and great work congrats
@lazalazarevic6192
@lazalazarevic6192 7 жыл бұрын
Welcome back :) and thanx for another great video
@rashidanwar7831
@rashidanwar7831 5 жыл бұрын
You are doing a great job. Keep it up and thank you.
@pan.sushant
@pan.sushant 3 жыл бұрын
Trying to run the same code to find index of date but it never matches - checked both date formats are same and ran it through to check via if loop to verify both are same but doesnt work with while loop and index of it doesnt read it as same. Date format as shown in logger example - Sun Aug 29 14:30:00 GMT-4:00 2021
@fantouch
@fantouch 6 жыл бұрын
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
@ExcelGoogleSheets
@ExcelGoogleSheets 6 жыл бұрын
getRange(2, 2, lr, 1).getValues().map(function(d){ return d[0] });
@fantouch
@fantouch 6 жыл бұрын
Thanks for the push, I will try it now and I will Google it to know what that do " funtion(d)".
@davidramos5510
@davidramos5510 5 жыл бұрын
getRange(2, 2, lr, 1).getValues().map(function(value) {return '' + value + ''});
@yehudagoldberg8577
@yehudagoldberg8577 2 жыл бұрын
What would I do if I want to get a match that is not exact? Where the formula I would write would look like MATCH(value,array,-1)
@rakeshkumarrakee
@rakeshkumarrakee 6 жыл бұрын
thankz for this great video bro....
@markuswinter-cdps3008
@markuswinter-cdps3008 4 жыл бұрын
Thanks for another great video. This is going to sound silly, but how much changes for completing this down a column instead of across rows? Does the array return change format?
@ExcelGoogleSheets
@ExcelGoogleSheets 4 жыл бұрын
The answer is here kzbin.info/www/bejne/iWa3k4Fpa6pri9k
@markuswinter-cdps3008
@markuswinter-cdps3008 4 жыл бұрын
@@ExcelGoogleSheets Thanks. I knew it was a silly question. Also, figured it out watching your Arrays & Map Method video. Awesome series. Thanks so much for doing them!!
@markuswinter-cdps3008
@markuswinter-cdps3008 4 жыл бұрын
@@ExcelGoogleSheets Please pardon my lack of knowledge with this stuff. What I've been trying to do is match the text string of cell on one sheet(1) to a cell on another sheet (2). Have now been able to accomplish this via indexOf. Now, I'm trying use offset to uncheck a checkbox on the same row as my matched cell on sheet 2. Cannot, for the life of me, figure out how to use the indexOf position (happens to be 11) as a reference to do this. Do I need to convert the position to the actual value (text string) of the cell? What am I missing, or is there a completely different (and better) way of accomplishing this? Thanks in advance.
@ExcelGoogleSheets
@ExcelGoogleSheets 4 жыл бұрын
Do you want to do this with a script or it doesn't matter?
@markuswinter-cdps3008
@markuswinter-cdps3008 4 жыл бұрын
@@ExcelGoogleSheets Script would be preferred, I guess, but not absolutely necessary.
@leemorris4054
@leemorris4054 4 жыл бұрын
Great video. I'm trying to modify this function to produce a row index but it doesn't show the range as CSV in the log, instead every cell data is in square brackets. Any ideas??
@danielromhany
@danielromhany 6 жыл бұрын
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.
@ExcelGoogleSheets
@ExcelGoogleSheets 6 жыл бұрын
Watch this video kzbin.info/www/bejne/iWa3k4Fpa6pri9k
@DavidMarcadet
@DavidMarcadet 5 жыл бұрын
Great vidéo, thank you so much!
@abhiskek270
@abhiskek270 6 жыл бұрын
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
@ExcelGoogleSheets
@ExcelGoogleSheets 6 жыл бұрын
.getValues()[0] gets you the first row in the column. You can search your column to find Deer like this. var arr2 = ss.getRange(2,1,r-1,1).getValues(); var deerPosition = arr2.findIndex(function(x){return x[0] == "Deer"}) + 1;
@chaitalikhona1617
@chaitalikhona1617 3 жыл бұрын
Can we identify the columns if the labels are in different rows?
@walterelemino
@walterelemino 4 жыл бұрын
I have a question, why my indexOf(SearchElement) is not showing when I try to put period after lookUpRangeValues? I copied all you code even the names are the same.
@ExcelGoogleSheets
@ExcelGoogleSheets 4 жыл бұрын
I don't know. So long as the code works, it doesn't matter.
@walterelemino
@walterelemino 4 жыл бұрын
Learn Google Spreadsheets It is working now, I forgot the terminator at the top of my code. Thank you so much
@ceeemmsss8149
@ceeemmsss8149 5 жыл бұрын
So where is part 17? Trying to add this to an existing script so that the formula remains static even if columns are added/removed. Right now my script is based on column numbers, so if a column is added or removed, I lose my formula
@dewaynewest7756
@dewaynewest7756 4 жыл бұрын
How would I compare 2 list from different sheets and return the index?
@giamar3026
@giamar3026 2 жыл бұрын
Hi, i ask you for help! first do you have any video where i can learn how to buil an script to replace text in column when it match with ALL cell content. I can't do it as the text is added (and not replaced)when i run my script twice using range.createTextFinder("cat").replaceAllWith("cat & dog"), even using replace(old,new). Thank you. And Also i use a separate sheet where one column have old values and side column new values, my goal is the system loop these column and the sheet where values are, but got errors too: function FindAndReplace4() { var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet(); var lrow = ss.getLastRow(); var rng = ss.getRange(2, 7, lrow - 1, 1); var data = rng.getValues(); //where listed categories var ss1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('animalsToreplace'); var lrow1 = ss1.getLastRow(); var rng1 = ss1.getRange(2, 1, lrow1 - 1, 1); var data1 = rng1.getValues(); for (var i=0; i < data.length; i++) { for (var j=0; j < data1.length; j++) { if (data[i][0] == data1[j][0]) { data.setValue(data1[j][1]); /*} else if (data[i][0] == "y") { data.setValue("Yes"); }else{*/ } } } }
@ExcelGoogleSheets
@ExcelGoogleSheets 2 жыл бұрын
range.createTextFinder("cat").matchEntireCell(true).replaceAllWith("cat & dog")
@giamar3026
@giamar3026 2 жыл бұрын
@@ExcelGoogleSheets thank you, very much!
@JayNirmalkarx
@JayNirmalkarx 2 жыл бұрын
Dear sir how i reject duplicate entry from matching existing sheet value
@shaitaan2011
@shaitaan2011 5 жыл бұрын
Anybudy tells me which coding using in Google sheet i want to know all coding of spreadsheet where will i get it.
@Rolroorlo
@Rolroorlo 3 жыл бұрын
How can I use this for a single column instead of a single row
@ericjohnson1144
@ericjohnson1144 5 жыл бұрын
I'm trying to do this with rows, but i'm logging 0 each time. var lr = ss.getLastRow(); var lookupRowValues = ss.getRange(4,2,lr,1).getValues()[0]; var indexRow = lookupRowValues.indexOf("AH-POR-DIF-BLK") + 1; Logger.log(indexRow); what am I doing wrong?
@ExcelGoogleSheets
@ExcelGoogleSheets 5 жыл бұрын
rows return array of arrays. Watch my array series to understand what's happening and how to fix it. kzbin.info/www/bejne/qovHhJRspZiDfrM&list=PLv9Pf9aNgemvD9NFa86_udt-NWh37efmD
@ericjohnson1144
@ericjohnson1144 5 жыл бұрын
​@@ExcelGoogleSheets Thank you so much. I got it cleared up! I'm a supply chain manager for a small company, and I've been able to automate so much of my work thanks to your videos!
@prodigroup
@prodigroup 3 жыл бұрын
What was the solution? This does not work for rows.
@computergeeks7546
@computergeeks7546 6 жыл бұрын
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; }
@ExcelGoogleSheets
@ExcelGoogleSheets 6 жыл бұрын
this line var columnIndex = headers.indexOf(columnlabel)+1; should be return headers.indexOf(columnlabel)+1;
@computergeeks7546
@computergeeks7546 6 жыл бұрын
Thank you. It works now! :-D
@maxieearle4364
@maxieearle4364 5 жыл бұрын
This doesn't seem to work if numbers are in the array? it returns an array of arrays.
@maxieearle4364
@maxieearle4364 5 жыл бұрын
Another thing, how do I do this so that it updates when the spreadsheet updates
@ExcelGoogleSheets
@ExcelGoogleSheets 5 жыл бұрын
convert array of arrays to regular array myArray = myArray.map(function(r){ return r[0] });
@Realmattvevo
@Realmattvevo 3 жыл бұрын
Hey compare find with array and textFinder please!
@Caldoyel
@Caldoyel 5 жыл бұрын
What can I do if I want to find a value in a column instead of a row?
@Caldoyel
@Caldoyel 5 жыл бұрын
Right now the lookupRangeValues is giving me an array of arrays but I want to search the array of arrays and return the array position I'm looking for. Is there a way to do that?
@ExcelGoogleSheets
@ExcelGoogleSheets 5 жыл бұрын
convert array of array to an array. Something like this should do it mylist = mylist.map(function(r){ return r[0]; });
@Caldoyel
@Caldoyel 5 жыл бұрын
@@ExcelGoogleSheets Thank you so much! That did the trick.
@phoenixempire8886
@phoenixempire8886 4 жыл бұрын
🙏🏻
@vijaybabukommuri5125
@vijaybabukommuri5125 2 жыл бұрын
How to use vlookup function or index match in appscript
@ExcelGoogleSheets
@ExcelGoogleSheets 2 жыл бұрын
You can't use the same functions in Apps Script, you have to build your own.
@bouyya4085
@bouyya4085 4 жыл бұрын
Hi, i need your help please, i need to know, how can I get the numbre of not_Empty Rows with Apps script pleaaaaaaase ??
@ExcelGoogleSheets
@ExcelGoogleSheets 4 жыл бұрын
I'm not entirely sure what you're trying to do, but skillwise everything you need is in this video and series associated with it. kzbin.info/www/bejne/nZKmY2xmjd-DjpY
@CreemosEnJesucristo
@CreemosEnJesucristo 6 жыл бұрын
how can I execute script with a key like the enter ? Excelent ... God Bless You.
@ExcelGoogleSheets
@ExcelGoogleSheets 6 жыл бұрын
I don't think you can.
Google Sheets - Combine All Sheets into One When Column Order Doesn't Match - Apps Script - Part 17
40:47
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 41 М.
How to VLOOKUP in Google Sheets with Apps Script?
17:16
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 41 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
JavaScript Filter Method Tutorial - Google Sheets Apps Scripts - Array Methods Part 7
27:19
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 72 М.
Apps Script - Difference Between Properties & Methods in Objects and Class Instances -  Live Stream
14:11
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 6 М.
JavaScript Arrays & Map Method Tutorial - Google Apps Script Part 4
26:53
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 55 М.
JavaScript indexOf, lastIndexOf Methods Tutorial - Google Sheets Apps Scripts - Array Methods Part 6
20:31
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 32 М.
10 INCREDIBLE things Google Sheets can do Right Now!
13:27
Jeff Su
Рет қаралды 100 М.
10 Excel Formulas That Will Set You Apart (+Cheat Sheet)
18:04
MyOnlineTrainingHub
Рет қаралды 388 М.
Google Apps Script For Loop
19:09
saperis
Рет қаралды 20 М.
How to Get The Last Row - Google Sheets Apps Scripts - Array Methods Part 10
24:34
Learn Google Sheets & Excel Spreadsheets
Рет қаралды 64 М.