問題描述
根據另一個單元格的值更改單元格的背景 (Changing background of a cell based on the value of another)
我需要根據不同列和行中的值(1、2、3、4 或 5)更改單元格的背景。例如,如果 cel A4 == 4
,則單元格 C19
將具有紅色背景。
參考解法
方法 1:
Have you tried something with Apps Script?
A code like this can give you ideas for their solution:
/* CODE FOR DEMONSTRATION PURPOSES */
function onEdit(e) {
if (e.range.getA1Notation() === 'C4')
if (e.value === '4') e.source.getRange('C19').setBackground('red');
else e.source.getRange('C19').setBackground('');
}
方法 2:
Your requirement seems very modest and I'm guessing you would like other colours or more complex criteria but I think the image 'says it all' as far as red fill in C19 if A4=4:
This is accessed via Format, Conditional Formatting...
The bottom right‑hand corner may be relevant. I'm using New Google Sheets that has much more powerful CF facilities than its predecessor.