简体   繁体   English

根据一个单元格的值更改多个单元格的字体属性

[英]Changing font properties of multiple cells based on one cell's value

I'm putting to good use one of the Excel posts on Conditional Formatting , but I'm having trouble applying it to multiple cells. 我正在充分利用有关条件格式的Excel帖子之一 ,但在将其应用于多个单元格时遇到了麻烦。 I have a row of cells: 我有一排牢房:

F4;G4;H4;I4;J4

in which G4 is a Yes/No dropdown list (these values come from another sheet). 其中G4是是/否下拉列表(这些值来自另一张纸)。 I tried: 我试过了:

Conditional Formatting > New Rule > Use a formula to determine which cells to format 条件格式>新规则>使用公式来确定要格式化的单元格

in the Format values where this formula is true I inserted =(G4="No") and it would apply bold + gray + strikethrough to the row of cells mentioned above (including G4 ). 此公式为真的格式值中,我插入=(G4="No") ,它将对上述单元格行(包括G4 )应用粗体+灰色+删除线

Problem: when I change the G4 value to No, only the first cell - F4 - changes. 问题:当我将G4值更改为No时,只有第一个单元格F4更改。

What am I doing wrong? 我究竟做错了什么?

As mentioned by @hsan: 如@hsan所述:

=$G4="No" should work = $ G4 =“否”应该起作用

but also the "Applies to" range should be: 而且“适用于”范围应为:

=$F$4:$J$4  

Without the anchor ( $ ) the references are relative, so F triggers the formatting because, relative to F , G is one column to the right and from F one column to the right shows No . 没有锚点( $ )的引用是相对的,因此F触发格式,因为相对于FG在右边一列,而在F右边一列显示No It may be easier to see what is happening if, with the “wrong” formula (but the same Applies to range of F:J ) you change the content of J4 to No . 如果使用“错误”公式(但对F:J范围相同)将J4的内容更改为No ,则可能更容易看到发生的情况。 I4 should now be formatted bold+grey+strikethrough. 现在应该将I4的格式设置为粗体+灰色+删除线。

Maybe think of the CF as rastering through the specified range, so where that is =$F$4:$J$4 , it starts in F4 and considers “does G4 equal No ?” then steps to G4 and asks “does H4 equal No ?” – and so on. 也许将CF视为经过指定范围的栅格化,所以在=$F$4:$J$4 ,它以F4开头并认为“ G4等于No ?”,然后转到G4并询问“ H4等于No ? “ - 等等。

With the anchor, the comparison is against ColumnG at every step in the cycle. 使用锚,将在循环的每个步骤中与ColumnG进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM