简体   繁体   English

Excel条件格式应用于意外更改的字段

[英]Excel Conditional Formatting Applies To Field Changing Unexpectedly

I have a spreadsheet where I calculate data by day for 3 week periods. 我有一个电子表格,可以在3周内按天计算数据。 Each day is compared to the previous day so I can see fluctuations in each row from day to day. 每天都与前一天进行比较,因此我可以看到每天每一行的波动。 I use conditional formatting to highlight positive or negative fluctuations assigning any negative values that appear as red text and any positive values as green. 我使用条件格式来突出显示正负波动,将任何负值显示为红色文本,将任何正值显示为绿色。 I only ever manually enter data into the columns for the specific days and allow excel to do the "heavy lifting" of subtracting one cell from another and then conditionally formatting based on the result. 我只在特定日期手动将数据输入列中,并允许excel进行“繁重的工作”,即从另一个单元格中减去一个单元格,然后根据结果进行有条件的格式化。 I've run this spreadsheet for over a year now, again working in 3 week increments, and in each of those 3 week sections the same column that represents day 4 (Column G in the screen shots) has the same problem. 我已经运行了一年多的电子表格,再次以3周的增量运行,在这3周的每个部分中,代表第4天的同一列(屏幕截图中的G列)也存在相同的问题。 I've ignored it for over a year and now I can't take it anymore. 我已经忽略了一年多了,现在已经受不了了。

Here's the issue. 这是问题。 I have no conditional formatting assigned to any of the columns that I type into, the columns represented with "Day #" in the screenshot of my spreadsheet. 我没有向我键入的任何列分配任何条件格式,这些列在电子表格的屏幕快照中均以“ Day#”表示。 But yet when I get to Day 4 and type any value into that column it gets the conditional formatting applied to it that only the columns that display my differences should have. 但是,当我进入第4天并在该列中输入任何值时,它就会应用条件格式,只有显示我的差异的列才应具有该条件格式。

NOTE : These screenshots are of a test instance of this problem that I created thinking the issue might be with my original file, but I was able to recreate the problem with a completely new spreadsheet. 注意 :这些屏幕快照是我创建的该问题的测试实例,我认为该问题可能与原始文件有关,但我能够使用全新的电子表格重新创建该问题。

I've had times where I've checked my conditional formatting 'Applies To' field prior to making any change to column G just to ensure that column, or any of its cells, aren't listed. 我曾经有过在对G列进行任何更改之前检查条件格式“适用于”字段的信息,以确保未列出该列或其任何单元格。 Then the moment I put a value into that column the cell I typed in gets added to the 'Applies To' field. 然后,当我在该列中输入值时,我键入的单元格即被添加到“适用于”字段中。 This only happens to this column, no other column on the spreadsheet. 这仅发生在此列上,电子表格上没有其他列。

Here's what I think I've found and I can't see a way around it, and unfortunately I think I need to get pretty detailed with what the spreadsheet does to really explain what I think is happening. 这是我发现的内容,我无法找到解决方法,但是不幸的是,我认为我需要对电子表格的功能进行详细说明,以真正解释我的想法。

  • Column A - Row title - no formulas 列A-行标题-没有公式
  • Column B - Represents Day 1 values - no formulas B列-代表第1天的值-没有公式
  • Column C - Represents Day 2 values - no formulas C列-代表第2天的值-没有公式
  • Column D - Represents the difference between day 1 and 2 - =C2-B2 D列-表示第1天和第2天之间的差-= C2-B2
  • Column E - Day 3 values - no formulas E栏-第3天的值-没有公式
  • Column F - Difference between day 2 and 3 - =E2-C2 F栏-第2天和第3天之间的差-= E2-C2
  • Column G - Day 4 values - no formulas G列-第4天的值-无公式
  • Column H - Difference between day 3 and 4 - =G2-E2 H栏-第3天和第4天之间的差-= G2-E2
  • Column I - Day 5 values - no formulas 第I栏-第5天的值-无公式
  • Column J - Difference between day 4 and 5 - =I2-G2 J栏-第4天与第5天之间的差-= I2-G2
  • Columns K through AD - remaining days and differences columns to represent the remaining days to get through 15 days worth of values and differences K列到AD列-剩余天数和差异列代表代表通过15天的值和差异的剩余天数

What I think is happening, and what I can recreate, is that Excel is getting confused at the fact that I have a pattern of conditional formatting for every other column, but that the first two columns where there's no "Difference" column between them (columns B and C) I have no conditional formatting and it tries to recreate that pattern in column G the moment I start typing values into that column. 我认为正在发生并且可以重新创建的是,Excel感到困惑,因为我每隔一列都有一种条件格式设置模式,但是前两列之间没有“差异”列( B和C列)我没有条件格式设置,当我开始在该列中输入值时,它会尝试在G列中重新创建该模式。 I can recreate this exact same issue no matter what the columns are, once I reach the 6th column in my pattern excel adds cells that I type values into to the conditional formatting rules. 无论列是什么,我都可以重新创建同样的问题,一旦到达模式中的第6列,excel就会将我键入值的单元格添加到条件格式设置规则中。

Has anyone else ever seen this? 有人看过吗? Any ideas on how to avoid it? 关于如何避免的任何想法? I thought it was related to copying and pasting my sections as we start a new 3 week period but the fact that I can recreate the issue from scratch consistently removes that theory. 我以为这与我们开始一个新的3周时间段时复制和粘贴我的章节有关,但是我可以从头开始重新创建问题的事实始终消除了这一理论。 Any help or ideas would be appreciated. 任何帮助或想法,将不胜感激。 The work around is of course simple enough but now I'm just curious as to what is causing this. 解决方法当然很简单,但是现在我只是想知道是什么原因引起的。

Blank spreadsheet prior to applying any values to any days. 在将任何值应用于任何日期之前,空白电子表格。 All of the formulas and conditional formatting is already applied to the Differences columns. 所有公式和条件格式都已应用于“差异”列。

At this point I've entered values into the columns for Days 1, 2 and 3. Note how the conditional formatting dashed lines don't include anything for Column G cells. 在这一点上,我已经在第一天,第二天和第三天的列中输入了值。请注意条件格式的虚线如何不包含G列单元格的内容。

After entering 2 values into cells in Column G those cells now appear in the Applies To fields for both of my conditional formatting rules. 在G列的单元格中输入2个值之后,这些单元格现在出现在两个条件格式设置规则的“应用于”字段中。

If someone can explain this I will send them all of the high fives I have. 如果有人可以解释这一点,我将把他们所有的高位击球送给他们。

For a proper explanation could mean asking Microsoft because you may have analysed the behaviour to about the extent possible without inside knowledge. 对于正确的解释可能意味着要问Microsoft,因为您可能在没有内在知识的情况下已对行为进行了尽可能多的分析。

However there are two simple workarounds. 但是,有两个简单的解决方法。 One is to apply a pair of rules for ColumnD that differ from the rules for the other columns. 一种是为ColumnD应用一对不同于其他列的规则。 The other, my recommendation, is to rearrange the difference columns so that each falls between its start/end points. 我的另一个建议是重新排列差异列,以使每个列都位于其起点/终点之间。 So the first would be in ColumnC with formula: 所以第一个将在ColumnC中使用公式:

=D2-B2  

copied down to suit. 复制下来以适合。

Then for conditional formatting select ColumnsC:AD, clear existing formatting and and HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true: : 然后对于条件格式选择ColumnsC:AD,清除现有格式,然后选择HOME>样式-条件格式,新规则..., 使用公式来确定要格式化的单元格,在此公式为true的情况下格式化值 ::

=AND(ISODD(COLUMN()),C1>0) 

Format... , select green font, OK , OK . 格式... ,选择绿色字体, 确定确定

Then for red font apply: 然后使用红色字体:

 =AND(ISODD(COLUMN()),C1<0)

Since this way the Applies to range is unbroken ( =$C:$AD ) Excel will not be tempted to 'interpolate' for you. 通过这种方式,“适用于范围”是不间断的( =$C:$AD ),因此Excel不会为您“内插”。

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

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