简体   繁体   中英

Excel Conditional Formatting - Highlight Date Range From Today

I have dates in Row 1 (1/1/2019, 2/1/2019, 3/1/2019, 4/1/2019 ...)

Trying to highlight the date between 2 to 5 months from today.
For example, If today is 6/24/2019, so it should highlight 8/2019 ~ 11/2019

I've tried to do
=AND((DATE(YEAR(TODAY()), MONTH(TODAY())+2,1)), MONTH(TODAY())+5)
But I think I need something like
MONTH(TODAY() > 2, MONTH(TODAY() < 5

Or maybe there is a better way to do this?

Your formula has to actually compare today's date to something .

Try something like this, eg to compare to cell A1 :

(I'm using eg TODAY()+30 instead of DATE(YEAR(TODAY()),MONTH(TODAY())+1,DAY(TODAY()) to keep it shorter but you get the idea.)

= AND((A1+60)>TODAY(),(A1+150)<TODAY())

Figured it out.
It was rather very simple.
=AND(A1>TODAY()+60,A1<=TODAY()+150)

Use de EDATE fórmula if you want to be more precise:

=AND(A1>EDATE(TODAY(),2),A1<=EDATE(TODAY(),5))

https://support.office.com/en-us/article/edate-function-3c920eb2-6e66-44e7-a1f5-753ae47ee4f5

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