Created
January 21, 2014 01:42
-
-
Save cignoir/8532897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aggregate() { | |
var ss = SpreadsheetApp.getActive(); | |
var sheet = ss.getActiveSheet(); | |
if(sheet == null){ | |
return; | |
} | |
for(var row = 2; row <= 40; row++){ | |
var okCount = 0; | |
var pendingCount = 0; | |
var ngCount = 0; | |
var tankCount = 0; | |
var healerCount = 0; | |
for(var col = 2; col <= 9; col++){ | |
var value = sheet.getRange(row, col).getValue(); | |
if(value == "○"){ | |
okCount++; | |
if(col == 2 || col == 3){ | |
tankerCount++; | |
} else if(col == 8 || col == 9){ | |
healerCount++; | |
} | |
} else if(value == "△"){ | |
pendingCount++; | |
} else if(value == "×"){ | |
ngCount++; | |
} | |
} | |
if(okCount > 0 && pendingCount == 0 && ngCount == 0){ | |
sheet.getRange(row, 1).setBackgroundRGB(166, 255, 164); | |
} else if(okCount > 0 && pendingCount > 0 && ngCount == 0){ | |
sheet.getRange(row, 1).setBackground("#F0E68C"); | |
} else { | |
sheet.getRange(row, 1).setBackground("#eff3f4"); | |
} | |
if(tankerCount + healerCount >= 2){ | |
sheet.getRange(row, 1).setFontColor("red"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment