[英]How to change cell value repeatedly by entering the value in other cell or sheet?
[英]How to countif or sumif in google sheet with background color count based on other cell value
我有谷歌表,我可以在這個插件“ https://chrome.google.com/webstore/detail/custom-count-and-sum/njikelndjpdbdngfkdgeijcpfabfgkb ”的幫助下計算表中相同的背景色列
現在我想在這里添加條件,我只想在 B 列為空時計算背景顏色。 我怎樣才能做到這一點?
這就是我現在擁有的
這就是我想要的
將此腳本粘貼到腳本編輯器中並保存。
function countBackGroudIf(range, reference, colorColumn, conditionColumn, condition) {
var sheet, color, colors, values;
sheet = SpreadsheetApp.getActive().getActiveSheet()
color = sheet.getRange(reference).getBackground();
colors = sheet.getRange(range).getBackgrounds().map(function (v) {
return v[colorColumn-1]
});
values = sheet.getRange(range).getValues().map(function (v) {
return v[conditionColumn-1]
});
return values.filter(function (el, ind) {
return el === condition && colors[ind] === color;
}).length
}
然后在你的電子表格中試試這個公式
=countBackGroudIf("A2:B20", "A3", 1, 2,)
看看有沒有效果?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.