Excel - 条件格式 - 插入行 [英] Excel - Conditional Formatting - insert row

查看:238
本文介绍了Excel - 条件格式 - 插入行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在适用于中使用偏移或间接似乎不起作用。有没有其他方法可以在插入行后停止条件格式化打破

我有一个范围的条件格式。 $Ø$ 19:$Ø$ 105条件是如果单元格值> 10,则格式化为红色。

I have a conditional format for a range for e.g. $O$19:$O$105. The condition is 'if cell value is > 10', it is formatted with red color.

问题是 - 当我在Excel中插入一行时,此格式化范围分割我得到2个格式规则。例如这两个规则的范围为$ O $ 19,$ O $ 21:$ O $ 105& $ O $ 20,如果我在第20行插入一个新行。

The problem is - when I insert a row in excel, this formatting range splits and I get 2 formatting rules. For e.g. the 2 rules with range as $O$19,$O$21:$O$105 & $O$20 respectively, if I insert a new row at 20th row.

通常对于像上面那样的条件,可能没关系,如果规则分为多个范围。但是,对于突出前10名的条件,它会导致不良的结果。

Typically for condition like the one above, it may not matter, if the rules are split into multiple ranges. But for conditions like 'highlight top 10', it causes undesired results.

我没有运气尝试以下操作:

I tried the following without much luck:


  1. 尝试使用间接 - 但是excel似乎解决了公式并保存了格式规则,因此不能像预期的插入一样使用

  2. 这里再次excel解决了与上述相同的范围。

任何人都知道如何编写不会与行插入中断的条件格式? / p>

Anyone knows how to write a conditional format that does not break with row inserts?


我意识到插入行不会导致条件格式化规则的拆分。我还会复制一行并粘贴到插入的行中。如果我选择特殊的粘贴和选择公式,它的工作正常。

I realized that insert row is not causing the splitting of the conditional formatting rules. I also copy a row and paste in the inserted row which is doing this. If I opt for special paste and choose formulas only, its working fine.


推荐答案

条件格式的一般问题。如果您插入行或移动,Excel会假定您希望条件格式与单元格一同移动,并且要插入具有原始格式的单元格(或根本没有)。

This is a general problem with conditional formats. If you insert rows or shift things around, Excel assumes that you want the conditional format to shift with the cells, and that you want to insert cells with their original formatting (or none at all).

所以它尽力根据变化来分割格式化的范围。不幸的是最好的不是很好。幸运的情况下,您的格式规则在您没有注意到的情况下重复;在不幸的情况下,他们会破坏部分或全部应用的范围。

So it tries its best to split up the formatted range according to the changes. Unfortunately "its best" is not very good. In lucky cases, your formatting rules get duplicated without you noticing; in unlucky cases they break for some or all of the applied range.

如果使用ListObjects(.k.a.Excel表),这尤其是一个问题。插入一些行,重新排序一下,拖动一些值,下一次查看条件格式列表时,你有几十到几百个重复的规则。 (例如: http://blog.contextures.com/archives/ 2012/06/21 / excel-2010-conditional-formatting-nightmare /

This is especially a problem if you work with ListObjects (a.k.a. "Excel tables"). Insert some rows, reorder it a bit, drag some values around and the next time you look into your conditional formatting list, you have dozens to hundreds of duplicate rules. (example: http://blog.contextures.com/archives/2012/06/21/excel-2010-conditional-formatting-nightmare/)

根据我的经验,解决混乱的最快方法是删除所有

In my experience the quickest way to fix the mess is to delete all rules and recreate them (or not).

一些旁注:


  • 适用范围始终是绝对的。没有办法。

  • 更糟糕的是,条件格式被视为易失性公式,意味着它们在很多场合(打开另一个文件,滚动等等)重新计算。如果您没有注意到分割,那么他们可以在一段时间后显着减缓整个应用程序。

  • 如果你去VBA,你可能想要使用Worksheet_Calculate事件,至少如果您的公式参考其他工作表(请注意名称!)

这篇关于Excel - 条件格式 - 插入行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆