基于公式Excel的条件格式

时间:2021-09-24 20:23:39

I am trying to create a rule for conditional formatting that highlights the column yellow if the header of the table contains the same value as is contained in cell A1, but it says my formula has an error. Does anyone have any ideas?

我正在尝试为条件格式创建一个规则,如果表的标题包含与单元格A1中包含的值相同的值,那么该规则将突出显示列黄色,但它说我的公式有一个错误。有人有什么想法吗?

Here is my formula:

这是我的公式:

 =CELL("col", INDIRECT(ADDRESS(ROW(), COLUMN()))) = (MATCH($A$1,Table1[#Headers],0)+2)

EDIT: The formula works when I put it into a cell, just not when I put it into the 'new rule' section of conditional formatting.

编辑:这个公式在我将它放入单元格时有效,而不是在我将它放入条件格式的“新规则”部分时有效。

1 个解决方案

#1


1  

Create a conditional rule applying to the relevant column (say G with header in $G$1) with the following rule:

创建一个适用于相关列的条件规则(例如,G,标头为$G$1),使用以下规则:

=AND(G1<>"",$A$1=$G$1)

I don't think you can reference the header with the Table Structured reference that you used which is why I hardcoded the range. Regards,

我认为你不能用你使用的表结构引用标题,这就是我硬编码范围的原因。问候,

#1


1  

Create a conditional rule applying to the relevant column (say G with header in $G$1) with the following rule:

创建一个适用于相关列的条件规则(例如,G,标头为$G$1),使用以下规则:

=AND(G1<>"",$A$1=$G$1)

I don't think you can reference the header with the Table Structured reference that you used which is why I hardcoded the range. Regards,

我认为你不能用你使用的表结构引用标题,这就是我硬编码范围的原因。问候,