Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9208141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:33:11+00:00 2026-06-18T00:33:11+00:00

Here is my function function Cool() { var h = SpreadsheetApp.getActiveSpreadsheet(); var range =

  • 0

Here is my function

 function Cool() {   var h = SpreadsheetApp.getActiveSpreadsheet();  
 var range = 0;   var count = 1;   var alph = ["A", "B", "C", "D", "E",
 "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
 "T"];   for (i = 0; i < 20; i+=0.5) {
     if (i == 19 && count != 5) {
       i == 0;
       count += 1;
     } else if (i == 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18) {
       range = h.getSheets()[0].getRange(alph[i] + count + ":" + alph[i] + count);
       SpreadsheetApp.setActiveRange(range);
       randomize();
     }   } }

that has an error on the

range = h.getSheets()[0].getRange(alph[i] + count + ":" + alph[i] + count);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:33:13+00:00Added an answer on June 18, 2026 at 12:33 am

    Have you looked at the data you are using ?

    here is a slightly modified version of your script with a logger to see what happens and the log result below. I guess you’ll understand why you get error messages . It seems your condition simplified syntax doesn’t do what you wanted, does it ?

    btw what is the final purpose of this script ? could you explain the idea ?

    If you wanted to do something only on integer values of i it would be easier to use something like if(i==parseInt(i)) for example…

    function Cool() {   
      var h = SpreadsheetApp.getActiveSpreadsheet();  
      var range = 0;   var count = 1;   var alph = ["A", "B", "C", "D", "E",
     "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
     "T"];   for (i = 0; i < 20; i+=0.5) {
         if (i == 19 && count != 5) {
           i == 0;
           count += 1;
         } else if (i == 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18) {
    //       range = h.getSheets()[0].getRange(alph[i] + count + ":" + alph[i] + count);
    //       SpreadsheetApp.setActiveRange(range);
     Logger.log('i='+i+'  '+alph[i] + count + ":" + alph[i] + count);
     //      randomize();
         }  
         }
         }
    

    LOGGER RESULT :

    i=0  A1:A1
    i=0.5  undefined1:undefined1
    i=1  B1:B1
    i=1.5  undefined1:undefined1
    i=2  C1:C1
    i=2.5  undefined1:undefined1
    i=3  D1:D1
    i=3.5  undefined1:undefined1
    i=4  E1:E1
    i=4.5  undefined1:undefined1
    i=5  F1:F1
    i=5.5  undefined1:undefined1
    i=6  G1:G1
    i=6.5  undefined1:undefined1
    i=7  H1:H1
    i=7.5  undefined1:undefined1
    i=8  I1:I1
    i=8.5  undefined1:undefined1
    i=9  J1:J1
    i=9.5  undefined1:undefined1
    i=10  K1:K1
    i=10.5  undefined1:undefined1
    i=11  L1:L1
    i=11.5  undefined1:undefined1
    i=12  M1:M1
    i=12.5  undefined1:undefined1
    i=13  N1:N1
    i=13.5  undefined1:undefined1
    i=14  O1:O1
    i=14.5  undefined1:undefined1
    i=15  P1:P1
    i=15.5  undefined1:undefined1
    i=16  Q1:Q1
    i=16.5  undefined1:undefined1
    i=17  R1:R1
    i=17.5  undefined1:undefined1
    i=18  S1:S1
    i=18.5  undefined1:undefined1
    i=19.5  undefined2:undefined2
    

    EDIT : being curious by nature I did try your code with the suggested IF statement and I get the following log (much nicer;-) but quite useless, a simple for loop with unity increments would do the same…

    i=0  A1:A1
    i=1  B1:B1
    i=2  C1:C1
    i=3  D1:D1
    i=4  E1:E1
    i=5  F1:F1
    i=6  G1:G1
    i=7  H1:H1
    i=8  I1:I1
    i=9  J1:J1
    i=10  K1:K1
    i=11  L1:L1
    i=12  M1:M1
    i=13  N1:N1
    i=14  O1:O1
    i=15  P1:P1
    i=16  Q1:Q1
    i=17  R1:R1
    i=18  S1:S1
    

    so the question remains : what was the final goal ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Jquery function here: function submit_selection(del,submit) { del='yes'; submit=true; var ITAMZ=new
I have two functions here function Preloader() {} Preloader.prototype = { init:function() { //
Here is function , <script type=text/javascript> $(document).ready(function() { getRecordspage(1, 5); $(a.page-numbers).click(function() { alert(1); getRecordspage($(this).text(),
$('#selector').click(function() { // here I would like to load a javascript file // let's
I've got a function here that is meant to look through a list of
simonn helped me to code an ordered integer partition function here. He posted two
I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
I need to pass an url from asp.net load_page to flowplayer javascript function here:
I'm trying to create a popup for which I am using jQuery's CSS function.Here's
I have the middleware that allows me to check user auth, here is: function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.