原文: https://www.cnblogs.com/MrFlySand/p/16383242.html
function 统计学生所有积分(){
alert("1")
/*var nameCell = Sheets.Item("官微").Range("C3").Value2;
alert(nameCell[4] == null)*/
for(var i = 2; i < 100; i++){
var integration = 0;
for(var j = 3; j < 100; j++){
var nameCell = Sheets.Item("视频").Range("E"+j).Value2; // 获取单元格的值,
var cell = Sheets.Item("积分表").Range("A"+i).Value2;
// alert(nameCell)
//匹配姓名
for(var a = 0; nameCell != null && nameCell[a] != null && nameCell[a+1] != null; a++){
var breakNum = 0;
for(var b = 0; cell != null && cell[b] != null; b++){
if(nameCell[a] == cell[b] && nameCell[a+1] == cell[b+1]){
//alert(a+","+b+":"+cell[b]+","+cell[b+1])
integration++;
a++;
b++;
// breakNum = 1;
// break;
}
}
// if(breakNum) break;
}
}
Sheets.Item("积分表").Range("E"+i).Value2 = integration;
}
alert("2")
}