Google Sheets Apps Script - If, Then, Else If, Else JavaScript Statements Tutorial - Part 6

Поділитися
Вставка
  • Опубліковано 11 жов 2024
  • Video tutorial series about Apps Script (JavaScript) in Google Sheets (Excel VBA Equivalent).
    In this tutorial we'll cover how to use If, Then, Else If, Else statements in Google Sheets scripts.
    Google Sheets
    www.google.com...
    Website:
    www.chicagocom...

КОМЕНТАРІ • 63

  • @MuhammadIbrahim-zc1vx
    @MuhammadIbrahim-zc1vx 4 роки тому +10

    Of all the tutorials I have seen, all the channels, you sir are truly a fine tutor. You explain things very nicely.
    I have learnt the most from you
    Thanks a lot!

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 роки тому +1

      Glad to hear that

    • @sachidanandsadhguru3703
      @sachidanandsadhguru3703 Місяць тому

      ​@@ExcelGoogleSheets Is there a way by which UDF of one Sheet is available in another in same Google Account?

  • @Tsunamiatunzen1
    @Tsunamiatunzen1 Місяць тому

    Some of the language wasn't functioning for me at first but it put me on the right track. Thanks!

  • @michaeltimpano1278
    @michaeltimpano1278 5 років тому +4

    Thanks for sharing your knowledge and expertise. I am learning so much from your video tutorials. I wish I could just work with you directly to complete some custom scripts for projects I am working on! These videos have been very helpful. Take care and all the best.

  • @trasformtessilesrl46
    @trasformtessilesrl46 5 років тому +2

    thanks !! you saved me!
    simple and clear!!! exactly what i need to learn, and noone explain it good and simple like YOU!!

  • @jonhollandWales
    @jonhollandWales 3 роки тому +1

    How can you use the If, else if to select different google docs templates based on an input from a cell. For example Option A selected in the cell populate template A, Option B selected populate template B. Love your videos, share them with colleagues when they're stuck

  • @user-ds7up1fi2y
    @user-ds7up1fi2y 21 день тому +1

    talented teacher

  • @admireargumentactivity
    @admireargumentactivity 6 років тому +1

    1:16 from 1h of tutorial binging the tutorialseries i most thankful for that sleight

  • @profocelsomarin4123
    @profocelsomarin4123 Рік тому +1

    tag times
    if = (começo) 4:00
    else = 7:05
    loop = (para iterar em um range) 8:10
    loop = (atenção com a sintaxe "{}" usar a tabulação para evitar erros) 9:00
    variável i = aplicando i na execução de if statements 10:17
    else if = para ter mais teste lógicos 11:42
    ordem dos if statements = (pensando a ordem das senteças) 14:22
    múltiplos else if = 16:26

  • @LanguageBLOX1_Alt
    @LanguageBLOX1_Alt 2 роки тому

    thanky you! please continue if you can I am loving this!

  • @costaluca78
    @costaluca78 5 років тому +2

    thank you so MUCH, this tutorial helped me a lot! Very clear explanation! well done

  • @hi2hai
    @hi2hai 3 роки тому

    You're a very good teacher!

  • @jonathanharcelldaraucheman7935
    @jonathanharcelldaraucheman7935 8 місяців тому

    Really helpful, thanks. What If I'd like to run a function when some criteria is met? I already have my function working, but I'd like to run it only when something is written in a specific cell.

  • @khanyameyiswa1356
    @khanyameyiswa1356 4 роки тому +1

    You explain so nice sir. You should create a course on UDEMY

  • @giancarloschafloqueguzman9918
    @giancarloschafloqueguzman9918 4 роки тому +1

    excelent

  • @khanyameyiswa1356
    @khanyameyiswa1356 4 роки тому

    Got it sir no problem. I changed my else statement to else if. My for loop contained else ifs only

  • @lovemishra8137
    @lovemishra8137 3 місяці тому

    easy explanation

  • @ashleysangma407
    @ashleysangma407 4 роки тому

    Very Helpful thank you so much!

  • @phoenixempire8886
    @phoenixempire8886 4 роки тому +1

    🙏🏻

  • @MiguelHernandez-oe8tl
    @MiguelHernandez-oe8tl 4 роки тому +1

    Thank you for your videos!. How could I get the selected item in a drop-down list in google form?

  • @rishirishi4970
    @rishirishi4970 2 роки тому

    Thanks

  • @yadday5153
    @yadday5153 5 років тому +2

    Can you refer to a core function in a custom function?

  • @computercomputer5125
    @computercomputer5125 5 років тому +1

    is there a way to save a macro for it to be use on other worksheets. Something like excels' " personal "

  • @osherezra131
    @osherezra131 7 років тому

    Great tutorials bro keep it up, thank a lot I was going crazy trying to find this formula, made my day :) How can I apply math to the "if" function? like if the sum of two cells are greater than a X number then .....
    Thanks in advance ,

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  7 років тому +1

      It seems like you're looking for this ua-cam.com/video/hG5vKMb0Lpo/v-deo.html

    • @osherezra131
      @osherezra131 7 років тому

      Wow that was quick man thank you so its basically the same as you do on formulas?
      regarding something else, Im watching all your app script playlist, but I still don't get the first section of the script regarding the- "var = SpreadsheetApp".... do I always do the same? can you maybe explain it with an example it will help a lot and thanks again keep it rolling you making great videos

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  7 років тому +1

      If you're not a programmer it is hard to make sense of it, that's what we call instantiating an object & it's impossible to explain if you don't have some programming background. For simplicity, let's just say yes, it will always be the same. Basically you just name the Google Sheets program under that name you use after var and then you refer to it using that name,

    • @osherezra131
      @osherezra131 7 років тому

      thanks, yeah I'm sure its not that easy, but it makes sense more and more even from this answer thanks a lot for the help appreciate that :)

  • @rnp9165
    @rnp9165 4 роки тому

    Are rows 3-4 only necessary when your function doesn't have a variable between the parentheses on line one?

  • @khanyameyiswa1356
    @khanyameyiswa1356 4 роки тому

    Hi Sir... I did exactly what you did but I'm getting different results. It seems like my else statement doesn''t work. Everything works except my else statement. Please help. Thanks in advance.

  • @BlokeBritish
    @BlokeBritish 2 роки тому

    i need to allow users to write to my sheet through a script but users should not be able to view/open the sheet manually.
    the script needs to capture current user email.
    is this possible ?

  • @farhanahmed8297
    @farhanahmed8297 6 років тому

    How to use if and function
    For example
    Column a:a is blank and column c:c is >0 so insert a new row in next column.
    So please provide google script for this condition

  • @surajdanavale8562
    @surajdanavale8562 4 роки тому

    Can u help me..
    How to set password to individuals google sheet.
    I m facing challenges in google sheet.
    We have 4 users .
    And I want to protect the sheets by password .
    When user1 open the Google sheet and only one sheet show other sheet want to hide..
    How to do that ????

  • @jhonnroh
    @jhonnroh 4 роки тому

    Hey, thanks for the tutorial. Is there a way to work with arrays? For example If = workingCell = "Me" setValue "It's You!"

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 роки тому

      ua-cam.com/play/PLv9Pf9aNgemvD9NFa86_udt-NWh37efmD.html

  • @ishwarisaskar7569
    @ishwarisaskar7569 4 роки тому

    if(approval == "Approved" && SalesNo != "") - Is this correct ? I took cell value In 'approval ' & 'SalesNo '

  • @edison.villamor
    @edison.villamor 2 роки тому

    Hi, thanks for the awesome tutorial. However, I'd like to ask how we can implement two conditions, first is Column A must be checked. and Column G must be 100%.
    I tried doing the following:
    if (data[i][0] == true && data[i][8] == "100%"){
    I'm not sure what I'm missing

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      your if statement is fine.
      The question is how did you get you data?
      Did you use getValues() or getDisplayValues()

  • @adelsonduarte3403
    @adelsonduarte3403 4 роки тому

    Is it possible to hide the rows or columns in Google Sheets from a condition being executed by a Script?

  • @computergeeks7546
    @computergeeks7546 6 років тому

    Can you make script for timestamp that won't change when the data is updated > for 'created date' column; and timestamp for 'edited date' column. I need the format in dd-mmm-yyyy. Thank's

  • @tribandrio598
    @tribandrio598 3 роки тому

    Why I can't Access the script editor, Can you help me sir? May be u have the solution,

  • @kenneyshepard4511
    @kenneyshepard4511 4 роки тому

    How would you do an if function but it doesn't equal something? I thought it was != but something about my if function isnt working properly. Here it is priority and status are variables. if(priority != "" && status != "Complete","Delayed")

  • @fabioSarmi
    @fabioSarmi 4 роки тому

    It is possible to set the if with two conditions to meet? For example, IF(x>10 and y>20) ?

  • @gaurishankar5092
    @gaurishankar5092 4 роки тому

    Is there any code to execute countif function through script editor

  • @Lottiee_
    @Lottiee_ 6 років тому +1

    Anyone happen to know how to use this with the previous "clear content" script video? For example. If cells in the range given contain "word" or"otherword" or "anotherword" then clearContent. Otherwise do nothing?

    • @sparkysrevenge3457
      @sparkysrevenge3457 5 років тому

      Take a look at isBlank in conjunction with an if, else

  • @cpanic1153
    @cpanic1153 6 років тому

    With all of these scripts reference locations, what happens if you add or remove a column or row? Traditional formulas update themselves. Do scripts?

  • @akeelabtan8606
    @akeelabtan8606 3 роки тому

    what if they strings

  • @remadas0
    @remadas0 3 роки тому

    How to close all sheets except the main sheet.

  • @ianupagarwal
    @ianupagarwal 6 місяців тому

    else do nothing. how can we do this?

  • @joni89qe
    @joni89qe 2 роки тому

    I get this error: "You do not have permission to call..."

  • @BrokenRecord-i7q
    @BrokenRecord-i7q Рік тому

    can you share the code please?

  • @nousernamethx
    @nousernamethx 7 років тому

    =IF(A6

  • @GOREMAXXX
    @GOREMAXXX 6 років тому

    I keep getting this error whenever I run:
    TypeError: Cannot call method "getActiveSheet" of null. (line 4, file "Code")
    This is my code:
    function myFunction() {
    var app = SpreadsheetApp;
    var activeSheet = app.getActiveSpreadsheet().getActiveSheet();
    var workingCell = activeSheet.getRange("B3:B1000").getValue();
    if(workingCell >= 10){
    activeSheet.getRange("C3:C1000").setValue("1st award");
    }
    }

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  6 років тому

      .getValue(); only works with a single cell.You have to use .getValues() and then loop though it.Watch arrays and ranges video for better understanding, You need to watch at least first half of my videos in this series to be able to understand what to do here.

    • @edo870
      @edo870 4 роки тому

      I received the same error regarding "getActiveSheet" of null... did you ever figure this out?

    • @edo870
      @edo870 4 роки тому

      Figured it out... I'm an idiot. I needed to create the new script from the Spreadsheet (that wasn't absolutely clear to me from previous videos). I went into the spreadsheet: Tools>Script Editor and now it's fine.