繁体   English   中英

对我的用于验证 Google 表格单元格的 While / 嵌套 if 语句的反馈

[英]Feedback on my While / nested if statements for validating Google Sheets Cells

刚刚开始我的 Js 之旅,目前正在使用 google 脚本来操作表格。 真的只是在寻找关于我离正确使用这个脚本语法有多近的建议?

我正在尝试使用嵌套的 if 语句来验证单元格,并给我一个 count(cValue) 关于有多少行符合日期范围内的条件。

var start = new Date("01/01/2022");
var end = new Date("01/31/2022");
var loop = new Date(start);
var processPoint = "";
var vessel = "";
var result = "";
var resultQTY = "";

var cell = sheet.getRange(5,1);
var cellPos = sheet.currentRange();
var selection = SpreadsheetApp.getActiveSpreadsheet().getSelection(cell);
var currentCell = selection.getCurrentCell();
var cValue = 0;

while(loop <= end){
    if(cell.getValues() < end) {currentCell + (+0, +5)
        if(currentCell = processPoint){currentCell + (+0, +1) 
          if(currentCell = vessel ) {currentCell + (+0, +3) 
            if (currentCell = result) {currentCell + (+0, +1) 
              if (currentCell = resultQTY){ cValue + 1, currentCell + (+1, -10) }}}}}
              else {currentCell + (+1, -10)}
            else {currentCell + (+1, -9)}
          else {currentCell + (+1, -6)}
        else {currentCell + (+1, -5)}
      else {currentCell + (+1, +0)}
}
return cValue;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM