简体   繁体   中英

Excel Conditional Formatting Applies To Field Changing Unexpectedly

I have a spreadsheet where I calculate data by day for 3 week periods. 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. 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. 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. 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.

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. 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
  • Column B - Represents Day 1 values - no formulas
  • Column C - Represents Day 2 values - no formulas
  • Column D - Represents the difference between day 1 and 2 - =C2-B2
  • Column E - Day 3 values - no formulas
  • Column F - Difference between day 2 and 3 - =E2-C2
  • Column G - Day 4 values - no formulas
  • Column H - Difference between day 3 and 4 - =G2-E2
  • Column I - Day 5 values - no formulas
  • Column J - Difference between day 4 and 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

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. 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.

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. 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.

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.

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.

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. 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:

=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: :

=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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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