简体   繁体   English

以条件格式复制上一个单元格的格式

[英]Copy format of previous cell in conditional formatting

My original question was Conditional format based on non-blank previous cell but i now realize that it was the wrong way to go. 我最初的问题是基于非空白先前单元格的条件格式,但我现在意识到这是错误的方法。 I don't need to format based on what the prior value was, just if the cell is blank copy the format from the previous cell. 我不需要根据先前的值进行格式化,即使该单元格为空白,也可以复制前一个单元格的格式。

I need to conditionally format a blank cell based on the previous cell 我需要根据前一个单元格有条件地格式化空白单元格

A    B    C    D    E    F    G
     AC             BW        IN
BW        BC        ST        IN

B1 has a conditional format based on the value AC. B1具有基于值AC的条件格式。 C1 is blank so it should get the B1 format. C1为空白,因此应为B1格式。 D1 is blank and should get the C1 format. D1为空白,应获取C1格式。 E1 is nonblank so it gets whatever the conditional format is. E1是非空白的,因此它可以获取任何条件格式。

The values in that will turn the formatting on come from a list of values ie AC, BC, IC, SC. 其中的值将打开格式,这些值来自值列表,例如AC,BC,IC,SC。

What i don't understand is how to copy, in the formula itself, the value of the previous format. 我不明白的是如何在公式本身中复制以前格式的值。

You can use a formula in conditional formatting that looks for the previous non blank value, eg if the cell should be formatted if it's equal to one of AC, BC, IC, SC.... or if it's blank and the previous value is in that list 您可以在条件格式中使用一个公式来查找先前的非空白值,例如,如果该单元格等于AC,BC,IC,SC ..... 或如果其为空白并且先前的值是在那个清单中

Use Name Manager to define a name for your list of values eg make 使用名称管理器为您的值列表定义名称,例如make

List ={AC","BC","IC","SC"} 列表= {AC“,” BC“,” IC“,” SC“}

Now use the following formula in conditional formatting for a range starting at A1 现在在条件格式中使用以下公式来计算从A1开始的范围

=MATCH(LOOKUP("zzz",$A1:A1),List,0)

This works for text values 这适用于文本值

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

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