简体   繁体   English

条件格式公式,以突出显示范围内的适当日期

[英]Conditional formatting formula to highlight appropriate date in range

I need a formula for conditional formatting that will highlight a date between A2:Z2 which matches a number that I enter into a “Committed Sessions Cell” (A1). 我需要一个用于条件格式的公式,该公式将突出显示A2:Z2之间的日期,该日期与我输入“ Committed Sessions单元格”(A1)的数字相匹配。 In row 2 there are a series of numbers that appear above each date column (1,2.3, etc). 在第2行中,每个日期列上方都有一系列数字(1,2.3等)。 For example, if I enter a “3” in cell A1, the date in J3 should match the number 3 above it and be highlighted. 例如,如果我在单元格A1中输入“ 3”,则J3中的日期应与其上方的数字3相匹配并突出显示。 The idea here is to provide a quick visual prompt for how many sessions are in a client's contract. 这里的想法是为客户的合同中的会话数提供快速的视觉提示。

Note: the sequenced numbers 1,2,3 etc in row 2 appear every 5th column (with nothing in between) but there IS other data in between the dates in row 3. Only the appropriate date should be highlighted. 注意:第2行中的序号1,2,3等每第5列出现一次(中间没有任何内容),但第3行中的日期之间还有其他数据。仅应突出显示适当的日期。

       A  B  C  D   E  F  G   H  I  J  K  L   M     

1      3
2      1            2               3                                           
3.     1/2/14       2/3/14          2/15/14             

With grateful thanks, 非常感谢

~ Jay 〜周杰伦

Your example is not consistent. 您的示例不一致。 If you have the date every fifth column, the dates should be in columns A,F,K,P, etc. with 4 columns between 2 points. 如果每五列有日期,则日期应在A,F,K,P等列中,并在2点之间包含4列。

I came up with the following formula: =AND(A2=$A$1,MOD(COLUMN(A3)-1,5)=0) which is applicable to the entire 3rd row. 我想出了以下公式:= AND(A2 = $ A $ 1,MOD(COLUMN(A3)-1,5)= 0)适用于整个第三行。 Create it as follow: 如下创建它:

  1. IMPORTANT: Select cell A3 (the reference point for the formula) 重要说明:选择单元格A3 (公式的参考点)
  2. Without selecting another cell, highlight the entire row 3 在不选择其他单元格的情况下,突出显示整行3
  3. Go to Conditional Formatting -> New rule 转到条件格式->新规则
  4. Choose "Use a formula to determine which cells to format" 选择“使用公式来确定要格式化的单元格”
  5. In "Format values where this formula is true", put =AND(A2=$A$1,MOD(COLUMN(A3)-1,5)=0) 在“设置该公式为真的值的格式”中,输入= AND(A2 = $ A $ 1,MOD(COLUMN(A3)-1,5)= 0)
  6. Choose the formatting that you want (example: Fill with yellow) 选择所需的格式(例如:用黄色填充)
  7. Click OK all the way 一直单击确定

NOTES : 注意事项

  1. To change the location of your Committed Sessions, change $A$1 to another cell. 要更改“承诺的会话”的位置,请将$ A $ 1更改为另一个单元格。 Important to keep the dollar signs 重要的是保持美元符号
  2. The MOD function is the one that controls every fifth column. MOD功能是控制每五列的功能。 If you want the highlight every 4th column (ie 3 cells between each point such as A, E, I, etc.), replace the number 5 with the number 4 如果要在第4列突出显示(例如,每个点之间的3个单元格,例如A,E,I等),则将数字5替换为数字4

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

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