Helping fixing my Script Function Google Spreedsheets -
i have script match 2 cell contents , homecoming color based on if numbers equal greater less or blank. issue on edit can watch each cell alter color before returns white when blank. kind of annoying... help can alter here? thanks!
https://docs.google.com/spreadsheets/d/1rtjyajtp2fkbf9vkcuogoaeueompvky7e947iumgzmk/edit?usp=sharing
function onedit() { var ss = spreadsheetapp.getactivespreadsheet(); var s = ss.getsheetbyname('sheet1'); var values1rule1 = s.getrange('b3:b').getvalues(); var values2rule1 = s.getrange('g3:g').getvalues(); var range3rule1 = s.getrange('h3:h'); var color1 = '#00ff00'; var color2 = '#00ffff'; var color3 = '#ffff00'; var color4 = '#ffffff'; (var row in values1rule1) { (var col in values1rule1[row]) { if (values1rule1[row][col] == values2rule1[row][col]) s.getrange(s.getrange('h3').offset(row, col, 1, 1).geta1notation()).setbackgroundcolor(color1); if (values1rule1[row][col] < values2rule1[row][col]) s.getrange(s.getrange('h3').offset(row, col, 1, 1).geta1notation()).setbackgroundcolor(color3); if (values1rule1[row][col] > values2rule1[row][col]) s.getrange(s.getrange('h3').offset(row, col, 1, 1).geta1notation()).setbackgroundcolor(color2); if (values2rule1[row][col] == '') s.getrange(s.getrange('h3').offset(row, col, 1, 1).geta1notation()).setbackgroundcolor(color4); }}};
google-apps-script google-spreadsheet google-docs
No comments:
Post a Comment