简体   繁体   中英

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

  1. Past dates (red): =AND(A1<TODAY(),A1<>"")
  2. Next date (amber): =AND(A1<>"",A1>=TODAY(),COUNTIFS($A$1:$A$8,"<"&A1,$A$1:$A$8,">="&TODAY())=0)

在此处输入图片说明

The A1<>"" is included to ignore blank cells.

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))``

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

Next day Formula = =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))

Note that if you decide to use these formula's within cells you must use "Ctrl + Shift + Enter" as this is an array formula.

在此处输入图片说明

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