[英]How can I colour a cell in excel based on the values in the cell next to it?
I've looked in to conditional formatting, but it doesn't manage relative references at all. 我研究了条件格式,但是它根本不管理相对引用。
what I would like to write is something like 我想写的是这样的
If ( the column number of this cell is more than the value in the first cell of this row)
colour it blue
end
It seems something really trivial, but writing something like: 看起来确实很琐碎,但是写的东西却是:
=IF($C$3+4<=COLUMN();COLUMN()-4<=$D$3)
always returns true (I guess ecause it takes COLUMN as a fixed number, say the value it gets the frist time it calls it) and so all cells are blue. 总是返回true(我猜是因为它将COLUMN作为一个固定数字,说它得到它调用的第一时间的值),因此所有单元格都是蓝色的。
that function returns the right value when evaluated inside the function field, but does not work for conditional formatting. 在函数字段中求值时,该函数将返回正确的值,但不适用于条件格式。
What can I do? 我能做什么?
Assuming you want something like this: 假设您想要这样的东西:
Select Columns A:H and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true: : 选择列A:H和HOME>样式-条件格式,新规则..., 使用公式确定要格式化的单元格,并在此公式为true的情况下设置值的 格式 :
=COLUMN()>$A1
Format... , select choice of formatting, OK , OK . 格式... ,选择格式选择, 确定 , 确定 。
You can do this with the normal conditional formula itself. 您可以使用常规条件公式本身来执行此操作。 Perform the following steps.
执行以下步骤。
Here the step 1 and 2 are critical to ensure that it is relative. 在这里,步骤1和2对于确保它是相对的至关重要。
Quite hard to understand what you want without having more informations. 没有更多信息,很难理解您想要什么。 Be that as it may, note that
请注意,
=IF($C$3+4<=COLUMN();COLUMN()-4<=$D$3)
Means 手段
if $C$3+4<=COLUMN()
return COLUMN()-4<=$D$3
otherwise return FALSE
如果
$C$3+4<=COLUMN()
返回COLUMN()-4<=$D$3
否则返回FALSE
If it always returns TRUE
it is because the tested cells are between the $C$3+4
th and the $D$3+4
th columns AND that $C$3 - $D$3
is a positive number which is sifficiently large for not beeing exceeded by the column number of the cells you test. 如果它总是返回
TRUE
那是因为测试的单元格在$C$3+4
和$D$3+4
列之间,并且$C$3 - $D$3
是一个正数,该数字足够大而不会超出根据您测试的单元格的列号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.