本文翻译自:Conditional formatting based on another cell's value
I'm using Google Sheets for a daily dashboard. 我正在使用Google表格作为日常仪表板。 What I need is to change the background color of cell B5 based on the value of another cell - C5. 我需要的是根据另一个细胞--C5的值改变细胞B5的背景颜色。 If C5 is greater than 80% then the background color is green but if it's below, it will be amber/red. 如果C5大于80%,则背景颜色为绿色,但如果它在下面,则为琥珀色/红色。
Is this available with a Google Sheets function or do I need to insert a script? 这可以使用Google表格功能,还是需要插入脚本?
#1楼
参考:https://stackoom.com/question/1OCwT/基于另一个单元格值的条件格式
#2楼
Note: when it says "B5" in the explanation below, it actually means "B{current_row}", so for C5 it's B5, for C6 it's B6 and so on. 注意:当在下面的说明中它说“B5”时,它实际上意味着“B {current_row}”,所以对于C5它是B5,对于C6它是B6,依此类推。 Unless you specify $B$5 - then you refer to one specific cell. 除非您指定$ B $ 5 - 否则您将引用一个特定的单元格。
This is supported in Google Sheets as of 2015: https://support.google.com/drive/answer/78413#formulas 自2015年起,Google表格支持此功能: https : //support.google.com/drive/answer/78413#formulas
In your case, you will need to set conditional formatting on B5. 在您的情况下,您需要在B5上设置条件格式。
- Use the " Custom formula i