Use Checkboxes to Increment / Decrement over a Range

Поделиться
HTML-код
  • Опубликовано: 24 окт 2024

Комментарии • 37

  • @jacekkulinski4414
    @jacekkulinski4414 10 месяцев назад +2

    had to modify for my use case but super helpful thanks dude

    • @SpencerFarris
      @SpencerFarris  10 месяцев назад +1

      That's the hope, glad it worked!

  • @kathleenlopez93
    @kathleenlopez93 8 месяцев назад +2

    Hi, I'm new to script. I got the buttons to work, but even with the provided script, I cannot get the checkboxes to function. My quantity, increase, and decrease are in columns f, g, h (respectively) but I cannot get the script to function. Do you have suggestions?

  • @aronejerome
    @aronejerome 8 месяцев назад +2

    do i need to install some extensions or something? i tried to copy the code from description and created the sheet from scratch like exactly in the vid. but it seems that the sheet is not connected on the app script?

    • @SpencerFarris
      @SpencerFarris  8 месяцев назад +1

      If you created the script from Extensions > "Apps Script" from the spreadsheet then it's already connected

  • @tmvtf-
    @tmvtf- 7 месяцев назад +1

    Thanks for this! Is it possible to make this work across multiple sheets at once?

  • @RayzenLagrange
    @RayzenLagrange Год назад +1

    Muito obrigado pelo video, eu cheguei a fazer uma função para cada botão e isso estava me enlouquecendo. Mas realmente gostaria de passar as cédulas por parâmetro, isso tornaria as coisas mais fáceis. Tem alguma ideia do porque o Google bloqueia essa ação?

    • @SpencerFarris
      @SpencerFarris  Год назад

      Não sei. Gostaria se for possível, mas obviosamente não é. Por que não quer user os checkboxes?

  • @lights8227
    @lights8227 9 месяцев назад +1

    I would like to use this function for my spreadsheet, but I have no idea how to get it to work. The value that has to be increased/decreased is in column F and I need 12 checkboxes in column H to column S. I currently have over 100 rows that I manually check every week and increase the value manually by using a calculator to set the new value. Would it be possible to achieve this and if so, how? I am a complete noob when it comes to this stuff, but I would love to make my work a lot easier and faster. Thanks!

    • @SpencerFarris
      @SpencerFarris  9 месяцев назад +1

      Should be totally possible. Can you add me as an editor so we can look at it best?

    • @lights8227
      @lights8227 9 месяцев назад +1

      @@SpencerFarris I have managed to get it working by asking a friend for help. Thanks for replying though!

    • @SpencerFarris
      @SpencerFarris  9 месяцев назад +1

      @@lights8227 I'm glad you were able to get it working

  • @anthonyevans2772
    @anthonyevans2772 2 месяца назад

    got the code to work, but what if I wanted to increment a value on another sheet? what part of the code do I have to edit to increment in a different cell on a different sheet?

  • @nikkim3212
    @nikkim3212 24 дня назад

    What do I need to change to execute this across all the sheets in a workbook?

    • @SpencerFarris
      @SpencerFarris  18 дней назад

      Get rid of src.getName() != "Checkbox" in the IF statement

  • @Employee1-rl3wd
    @Employee1-rl3wd 8 месяцев назад +1

    Hello Spencer how about if I need 2 column to increase and decrease how should I script it? thank you for your reply

    • @SpencerFarris
      @SpencerFarris  8 месяцев назад

      Meaning what, exactly? A single checkbox should change both?

    • @Employee1-rl3wd
      @Employee1-rl3wd 8 месяцев назад

      @@SpencerFarris example I have 6 columns A-F. A for Count, C&D for increase and decrease. but I also want to put another set at Column D,E & F

    • @SpencerFarris
      @SpencerFarris  8 месяцев назад +1

      @@Employee1-rl3wd if (r.columnStart == 2 || r.columnStart == 5){
      ...
      } else if (r.columnStart == 3 || r.columnStart == 6){
      ...
      }

    • @Employee1-rl3wd
      @Employee1-rl3wd 8 месяцев назад

      @@SpencerFarris Thank you very much : )

  • @FORYOU-wb1rx
    @FORYOU-wb1rx Год назад +1

    From India 👍

  • @TheRenegadeLife
    @TheRenegadeLife Год назад +1

    Thanks for this video. I tried the code and it doesn't seem to be working for me. I click the checkbox and nothing happens. But there are no errors on my code. Hmm.

    • @SpencerFarris
      @SpencerFarris  Год назад +1

      Without seeing your sheet or at least your code I can't really help troubleshoot

    • @TheRenegadeLife
      @TheRenegadeLife Год назад

      function incrementAndDecrement(e){
      const src = e.source.getActiveSheet();
      const r = e.range;
      if (src.getName() != "Checkbox" || r.columnStart < 2 || r.columnStart > 3) return;
      let out;
      if (r.columnStart == 2){
      out = r.offset(0,-1);
      out.setValue(out.getValue()+1)
      } else {
      out = r.offset(0,-2);
      out.setValue(out.getValue()-1)
      }
      r.setValue("FALSE");
      }
      My form looks the same as yours.
      Am I missing something?
      @@SpencerFarris

  • @Sentinaut
    @Sentinaut 5 месяцев назад

    Syntax error: SyntaxError: Unexpected identifier 'less_than_carat' line: 11 file: On Edit.gs

    • @tylerboston1714
      @tylerboston1714 5 месяцев назад +1

      Hi Sentinaut, just replace the 'less_than_carat' with < and the 'greater_than_carat' with > and hit save and should be good to go.
      Also make sure your sheet name (tab at the bottom) is named the same thing as what's in this line if (src.getName() != "Checkbox". Ex. if your sheet tab is called ABC, then change "Checkbox" to "ABC".

    • @SpencerFarris
      @SpencerFarris  5 месяцев назад +1

      @@tylerboston1714 Thanks Tyler! @Sentinaut, RUclips doesn't allow the carat symbols < or > in the description.

    • @Sentinaut
      @Sentinaut 5 месяцев назад

      @@SpencerFarris ah I see

  • @TechSupportDave
    @TechSupportDave 11 месяцев назад +1

    Can you help me? The code simply does not work for me. I have a much simpler thing I need where I only need to INCREMENT a row of numbers with a checkbox. Nothing else.
    edit: Decided to just re-design my huge sheet around your (working) document that you provided in the description. Took a bit of time and I still have no idea why I wasn't able to just copy-paste your code into my document, but I was able to copy-paste my document into your file... coding shenanigans.

    • @SpencerFarris
      @SpencerFarris  11 месяцев назад

      Did it work?

    • @TechSupportDave
      @TechSupportDave 11 месяцев назад

      @@SpencerFarris yes, but i have no idea why it works! hahah

    • @yannickrasschaert8064
      @yannickrasschaert8064 8 месяцев назад

      @@TechSupportDave Could it be because of the check he added to be sure that the sheet name was "Checkbox"?
      That would explain why copy pasting his code in your sheet did not work but the other way around did.

    • @TechSupportDave
      @TechSupportDave 8 месяцев назад

      @@yannickrasschaert8064 Maybe! Well, it's a simple skill issue if I can't get simple code to work, even if it is in an unfamiliar language. I'm much more informed now and don't experience these kinds of basic issues with sheets anymore.

    • @kevinmetcalf413
      @kevinmetcalf413 2 месяца назад

      @@yannickrasschaert8064 Can't thank you enough for this. Renaming my tab solved a similar problem for me. +1