基于单元格N1中的值的单元格A1中的条件格式
AN 1 My Test 0
如果单元格N = 0中的值,如何使MyTest成为红色字体? 我探讨了条件格式,但它似乎并没有允许我设置条件的其他单元格的值不同的自身..
这是你做的。 转到Home > Styles > Conditional Formatting > New Rule > Use a formula ...
,这是您可以尝试的公式:
=($N1=0)
关键是$
符号,我只在N
前面设置$
符号,因为我不希望当我拖动公式时N
被改变。 你需要确定这是你想要的。
然后我有这个设置适用于=$A$1:$A$5
单元格在我的例子中,你将需要相应地调整它。 希望这可以帮助,但让我知道任何问题。
您可以使用条件格式,如下所示。
解释 – L1 – 连接到所选范围内的第一个单元格(对于K1,它使用L1,对于K2,使用L2等),2它等于的值。
您需要适当地使用固定/dynamic单元格。
受影响的地区将是:
=A1 'Note no $s
公式将是:
=N1=0 'Again, no $s... i think F4 will actual sort through the options of where the $ goes, when in the field
如果您要完成一整行颜色,则基于公式= N1 = 0,受影响的范围将为:
=$A1
然后为true设置颜色。
有助于在设置新规则之前select受影响的范围。 如果您在设置规则之前没有select受影响的范围,请在设置规则公式之后返回。
你可以尝试使用VBA代码。 将以下过程添加到ThisWorkbook
。
Private Sub Worksheet_Change(ByVal Target As Range) If Range("N1").Value = 0 Then Range("A1").Font.ColorIndex = 3 ' 3 indicates Red Color End if End Sub
每当您的工作表中的内容发生更改时,此过程就会运行。 如果只需要在N1更改时运行,则可以添加以下代码。
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$N$1" Then If Target.Value = 0 Then Range("A1").Font.ColorIndex = 3 ' 3 indicates Red Color End If End if End Sub
希望能帮助到你