简体   繁体   English

Excel公式根据时差突出显示单元格

[英]Excel Formula to highlight cell based on time difference

I want to highlight a cell if that cell and another cell its within 1.5 hours. 我想突出显示一个单元格,如果该单元格在1.5小时内突出显示。 So if A1 is 5/9/2016 06:55 and A4 is 5/9/2016 08:10 , they are within 1.5 hours apart, so highlight A4. 因此,如果A1是5/9/2016 06:55而A4是5/9/2016 08:10 ,则它们相距1.5小时以内,因此突出显示A4。

Looking at this answer and this Office page , you want to set a formula like: 查看此答案此Office页面 ,您想要设置一个公式,例如:

  1. Select cell A4 and click the Conditional Formatting button in the ribbon and choose "New Rule" 选择单元格A4,然后单击功能区中的“条件格式”按钮,然后选择“新建规则”

  2. Select "Use a formula to determine which cells to format" 选择“使用公式来确定要格式化的单元格”

  3. Enter the formula =IF(ABS(A4-A1)*24 < 1.5, TRUE, FALSE) 输入公式=IF(ABS(A4-A1)*24 < 1.5, TRUE, FALSE)

  4. If you want cell A1 to be a fixed reference so that copy-paste will work, you can instead enter the formula =IF(ABS(A4-$A$1)*24 < 1.5, TRUE, FALSE) , or name the cell 如果希望将单元格A1用作固定引用,以便复制粘贴起作用,则可以输入公式=IF(ABS(A4-$A$1)*24 < 1.5, TRUE, FALSE)命名该单元格

  5. Set the format to highlight the cell 设置格式以突出显示单元格

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

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