Excel - Conditionnal formatting with formula not working but the formula itself works

倖福魔咒の 提交于 2020-01-16 08:38:49

问题


I'm trying to format a column of file paths depending on their extension (e.g. .css).

The said column of file paths looks like the following (3rd column)

In another sheet, I have the following table named FileExtensionsTbl in which every column contains the extension for a conditional format. For example, all the extensions in column CSS would be used to match a specific style like all files ending with .css would match the CSS conditional format.

I came up with a formula that works when used in the same sheet where the file paths are.

Here is the formula:
=NOT(ISNA(MATCH(LOWER(RIGHT(RC3; LEN(RC3)-FIND(".";RC3)+1)); FileExtensionsTbl[CSS]; 0)))

Here is the result (4th column):

The problem is that I can't figure out a way to make it work as a formula for conditional formatting.

Here is the error I get when I try to use it in conditional formatting:

Note: I'm using the R1C1 reference notation (relative)


回答1:


It seems you can't use structured references in conditional formatting formulas. Two suggestions:

1) Replace FileExtensionsTbl[CSS] by its column reference. Assumed CSS types are on the sheet File Extensions in column A your formula would be:

=NOT(ISNA(MATCH(LOWER(RIGHT(RC3; LEN(RC3)-FIND(".";RC3)+1)); 'File Extensions'!A:A; 0)))

2) Or use this trick and enclose the structured reference with INDIRECT:

=NOT(ISNA(MATCH(LOWER(RIGHT(RC3; LEN(RC3)-FIND(".";RC3)+1)); INDIRECT("FileExtensionsTbl[CSS]"); 0)))


来源:https://stackoverflow.com/questions/59073868/excel-conditionnal-formatting-with-formula-not-working-but-the-formula-itself

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!