简体   繁体   中英

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. 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.

Looking at this answer and this Office page , you want to set a formula like:

  1. Select cell A4 and click the Conditional Formatting button in the ribbon and choose "New Rule"

  2. Select "Use a formula to determine which cells to format"

  3. Enter the formula =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

  5. Set the format to highlight the cell

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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