简体   繁体   English

Excel条件格式-突出显示具有TODAY的下一个日期的行

[英]Excel Conditional Formatting - Highlight row with the next date from TODAY

I have a number of dates throughout the year that have 3 weeks gaps between them. 我全年有很多约会,彼此之间有3周的间隔。 im looking to highlight the past dates in red and only the next date in amber. 我希望以红色突出显示过去的日期,而仅以琥珀色突出显示下一个日期。

在此处输入图片说明

Assuming your dates are in A1:A8 (adjust ranges as necessary), you could create two rules based on the following formulas: 假设日期在A1:A8 (根据需要调整范围),则可以根据以下公式创建两个规则:

  1. Past dates (red): =AND(A1<TODAY(),A1<>"") 过去的日期(红色): =AND(A1<TODAY(),A1<>"")
  2. Next date (amber): =AND(A1<>"",A1>=TODAY(),COUNTIFS($A$1:$A$8,"<"&A1,$A$1:$A$8,">="&TODAY())=0) 下一个日期(琥珀色): =AND(A1<>"",A1>=TODAY(),COUNTIFS($A$1:$A$8,"<"&A1,$A$1:$A$8,">="&TODAY())=0)

在此处输入图片说明

The A1<>"" is included to ignore blank cells. 包含A1<>""以忽略空白单元格。

Here is a different solution, that I believe is very straight forward and doesn't require multiple statements. 这是一个不同的解决方案,我认为这很简单,不需要多个语句。

Old Dates (if no "Next Day" dates are found, then nothing will change colors) = `=A1TODAY(),$A$1:$A$8))`` 旧日期(如果未找到“第二天”日期,则不会更改颜色)=`= A1TODAY(),$ A $ 1:$ A $ 8))''

Old Dates (including Today) Formula (This code will change colors regardless)= $A1=AND($A1<=TODAY(),$A1<>"") - Similar to BigBen (Difference is that I include Today() ). 旧日期(包括今天)公式(无论如何,此代码都会更改颜色)= $A1=AND($A1<=TODAY(),$A1<>"") -与BigBen相似(区别在于,我包括Today() ) 。

Next day Formula = =A1=MIN(IF($A$1:$A$8>TODAY(),$A$1:$A$8)) 第二天公式= =A1=MIN(IF($A$1:$A$8>TODAY(),$A$1:$A$8))

Everyday after today (just in case)= =A1>=MIN(IF($A$1:$A$8>TODAY(),$A$1:$A$8)) 今天后的每一天(以防万一)= =A1>=MIN(IF($A$1:$A$8>TODAY(),$A$1:$A$8))

Note that if you decide to use these formula's within cells you must use "Ctrl + Shift + Enter" as this is an array formula. 请注意,如果决定在单元格中使用这些公式,则必须使用“ Ctrl + Shift + Enter”,因为这是一个数组公式。

在此处输入图片说明

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

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