简体   繁体   中英

How to use Conditional Formatting between a cell pulling info from a date and comparign to a cell that includes only text

I have an Excel spreadsheet that has sections broken out by month. The headers are individual month names, not dates. Each of these is color-coded to match the month. I have a single cell set aside to display the current month (using the TODAY function). I want to be able to style the cell depending on which month of the year it is.

I set 12 conditional formatting rules to check the cell against. I started out by using ="November" (as an example), but it doesn't seem to equate (TODAY()) with the word "November," so the rule doesn't apply. Either I need a new formula for the cell or there's some formula I have to use in the conditional formatting to get it to recognize the similarity between a date-formatted cell and a text-formatted cell.

Any ideas?

Assuming the cell is in A2, I would just change your conditional formatting formula to something like

=MONTH(A2)=11

TODAY() actually saves the Excel date value (eg 42695 for today) but using the MONTH() function will return the month number.

You could also alter the TODAY() formula to be something like

=TEXT(TODAY(),"mmmm")

That will convert the visible date to just show the month name and should still work for your original conditional formatting 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