[英]Excel: Dynamic Conditional Formatting and Erroneously Defaulting References
All, I have a two-stage question regarding some slightly complex Conditional Formatting. 所有,关于一些稍微复杂的条件格式,我有两个阶段的问题。
Sample Table below. 下面的样品表。
A B C D
1 Options Choice Billy Suzie
2 Option 1 Dog Option 1 Option 2
3 Option 2 Cat
4 Option 3 Snake
Description: 描述:
Goal: 目标:
Questions: 问题:
I would like to select A1:B4 and generate one conditional formatting statement for each child. 我想选择A1:B4并为每个孩子生成一个条件格式语句。 Ie select them all, and gen. 即全部选中它们,然后生成。 the formatting rule "$A1=$C$1 ---- Highlight Blue". 格式规则“ $ A1 = $ C $ 1 ----高亮显示蓝色”。 And, by generating that rule, A3 and B3 would turn Blue if Billy selected Option 3. Currently, I am having to generate a statement for each row. 并且,通过生成该规则,如果Billy选择了选项3,则A3和B3将变为蓝色。当前,我必须为每一行生成一条语句。 Couple this with the fact that I have to do the three colors, I have to generate 3 rules per Option, rather than just 3 rules total. 再加上必须要做三种颜色的事实,我必须为每个Option生成3条规则,而不是总共3条规则。
Bonus: This is less a question of how and more a question of why: I figured out half of the answer to question 2, and was able to select A1:B1 for each category (pets, toys and dinner) using Ctrl, and create a rule for each highlighted color using the formula "=$A1=$C1". 奖励:这不是一个如何做的问题,而是一个为什么的问题:我找出了问题2的一半答案,并且能够使用Ctrl为每个类别(宠物,玩具和晚餐)选择A1:B1,并创建使用公式“ = $ A1 = $ C1”的每种突出显示颜色的规则。 This made it so to where each category was independent of the other categories (billy selecting a dog wouldn't highlight a bike in a subsequent table, I would have to select bike for billy in that table). 这样一来,每个类别都可以独立于其他类别(在随后的表格中选择一只狗不会突出显示自行车,我必须在该表格中为比利选择自行车)。 BUT, when you click on a cell to add it into the formula box, it automatically gives it an absolute reference ($A$1). 但是,当您单击一个单元格以将其添加到公式框中时,它将自动为其提供绝对引用($ A $ 1)。 I did this, and then would delete the 2nd "$" for each cell. 我这样做了,然后删除每个单元格的第二个“ $”。 Once I hit "Ok" or "Apply", the cell reference would change, without fail, to "$A1048576", ie the bottom cell in that column. 一旦我单击“确定”或“应用”,单元格引用将毫无疑问地更改为“ $ A1048576”,即该列中的底部单元格。 I could manually change the number back to what I wanted, $A1, and it would accept the change and work how I wanted, but the behavior was VERY strange, and I was wondering if anyone knew what was happening/causing it. 我可以手动将数字改回我想要的值,$ A1,它会接受所做的更改并按我的意愿工作,但是这种行为非常奇怪,我想知道是否有人知道发生了什么/造成了什么。
This is a small, representative table for what I am trying to accomplish. 这是我要完成的小型代表表格。 The real data is more complex. 实际数据更为复杂。
Thanks in advance to anyone trying to answer this. 预先感谢任何尝试回答此问题的人。
There are a multitude of questions here, mainly (a) how to achieve without too much effort the various fills given the criteria (each fill potentially a different question) and (b) why certain behaviour. 这里有很多问题,主要是(a)如何在不付出过多努力的情况下实现给定标准的各种填充(每个填充可能会导致一个不同的问题),以及(b)为什么某些行为。 Considering only (a) and specifically your Q 1., first 'standard' fill grey to suit Then select Columns A and B 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)特别是Q 1.,首先使用“标准”填充灰色以适合,然后选择A列和B列以及HOME>样式-条件格式,新规则..., 使用公式来确定要格式化的单元格和格式化此公式为真的值 ::
=AND($D$1="Suzie",$D$2=$A1)
Format... , select red colour Fill, OK , OK . 格式... ,选择红色填充, 确定 , 确定 。
Then repeat with: 然后重复:
=AND($C$1="Billy",$C$2=$A1)
for blue, and for green: 对于蓝色,对于绿色:
=AND($C2=$D2,$A1=C$2,$C2<>$D2)
In general, you must expect one rule per colour. 通常,您必须期望每种颜色有一个规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.