且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Google表格 - 如何突出显示与其他单元格的值匹配的单元格?

更新时间:2022-10-30 23:06:42

对条件格式使用自定义函数。例如,如果您描述的列在第2行中,则该函数将针对> = A2 < = B2

  = AND(C2> = $ A2,C2   

选择您希望为其创建条件格式的单元格范围; C2..L2 ,比方说。打开条件格式对话框,然后选择自定义公式。输入上面的公式;请注意,itr是指您希望将公式应用于该公式的范围的左上角 - 表格会自动调整该范围的剩余部分,这就是为前两列使用绝对引用非常重要的原因。




  • I have a row of values (say 1-10)
  • At the beginning of the rows I have 2 numbers generated from dates from other cells that represent week numbers. (eg, 3 and 9)
  • I want my row to highlight all the numbers from 1-10 that are between the values from the week number cells. (eg the cells with numbers 3,4,5,6,7,8 and 9 will automatically turn a colour (say green))

I've tried the conditional format, using the "between" values. It doesn't work.

If I just type the numbers into the format box, it will work, but the problem is I need it to refer to the value in the cell NOT a number I type in, because there is a likelihood that the dates could change, which will affect the value shown in week number cell, so I need it to work automatically and not require me to go through every single row changing values for the formatting.

Is this even possible on sheets?

Thanks in advance, I am hoping I've just overlooked something simple.

Use a custom function for conditional formatting. For instance, if the columns you describe are in Row 2, this function will evaluate "TRUE" for numbers that are >= A2 and <= B2:

=AND(C2>=$A2,C2<=$B2)

Select the range of cells you wish to create a conditional format for; C2..L2, say. Open the conditional formatting dialog, and choose "Custom formula". Enter the formula above; note that itr refers to the top-left corner of the range you wish to apply the formula to - Sheets will automatically adjust it for the rest of the range, which is why it's important to use absolute references for the first two columns.