如果当前单元格存在于某个范围内,则在 Google Docs 中应用条件格式

A.B*_*oll 6 google-docs google-sheets gs-conditional-formatting

很简单,如果该单元格与来自不同列(特别是在不同工作表中)的不同单元格匹配(完全匹配),我会尝试突出显示该单元格。

例如,我的 Google 文档电子表格中有一个“活动”和“非活动”表格。“非活动”中列出的一些项目也列在“活动”中,我需要强调这些。

到目前为止我得到的是这个(这不起作用):

  • 格式 -> 条件格式
  • 格式化单元格如果 -> 自定义公式是
  • GT(MATCH(A1, 'Active'!A2:A, 0), 0)

The general formula above works if I use it in the spreadsheet normally and correctly pass the 1st parameter to MATCH(), however when I attempt to move the regular formula to a conditional formatting, it seems to break down: I need to pass the current cell's contents as the 1st parameter, not A1 statically. If using GT() + MATCH() is indeed the correct way to accomplish this, I need a way to express:

GT(MATCH(  'Inactive'! [A + ROW()]  , 'Active'!A2:A, 0), 0)
Run Code Online (Sandbox Code Playgroud)

... Where A+ROW ends up being the non-literal expression, -- i.e. on row 123 this would refer to the cell contents of A123.

There may be also an easier and more intuitive way to do this altogether. To state my problem in a different way, "If the current cell's data [a string] is present (or 'matches') in the range 'Active'!A2:A then highlight it".

Aks*_*lov 7

The problem is that when you are using a different sheet in conditional formatting you need to pass it using INDIRECT(). Use this formula in conditional formatting:

=GT(MATCH(A1, INDIRECT("'Active'!A2:A"), 0), 0)
Run Code Online (Sandbox Code Playgroud)

And apply it to range A1:A. You do not need to pass the row number, google does it for you.