+ Reply to Thread
Results 1 to 15 of 15

Conditional formatting using months of dates

  1. #1
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Conditional formatting using months of dates

    I've researched this and researched this and nothing is really working.

    I would like to conditional format cells based on the month of the date entered into it.

    For current month. example: MONTH(TODAY()), then it highlights Red
    If it's next month. example: MONTH(TODAY()+1), then it highlights Orange
    between 1 and 3 months out. example: MONTH(TODAY()+1<=Cell<=MONTH(TODAY()+3)

    But for some reason I can't get anything to work other than =MONTH(C12)<=MONTH(NOW()) for the red

    Thanks in advance for any help.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    For this month...
    =AND(C2>EOMONTH(TODAY(),-1),C2<=EOMONTH(TODAY(),0))
    for next month...
    =AND(C2>=EOMONTH(TODAY(),0),C2<=EOMONTH(TODAY(),1))
    for 3 months and more...
    =C2>EOMONTH(TODAY(),2)

    Note, it may be better if you put =TODAY() in it's own cell, then referenced it. If used too much, that function could start to slow your file down
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    I inserted those in using formula and none are working. Maybe I'm doing something wrong, but I don't think so.

    And would AND(C2>=EOMONTH(TODAY(),2),C2<=EOMONTH(TODAY(),3)) get me those months between 2 and 3 months out? I don't need 3 months and more, I need 2 and 3 months out on that last one.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    I have adjusted the 3rd formula to look btw 2 and 3 mths.

    I have copied your table over and applied my rules
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    Still doesn't look like its working as needed, some dates that should be highlighted are not and some that shouldn't are. Not sure where the disconnect is but I do appreciate your help.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    Tell me which 1's you feel are wrong please

  7. #7
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    =AND(C2>=EOMONTH(TODAY(),1),C2<=EOMONTH(TODAY(),2))
    And then this should highlight July and August. Correct? or does it need to be 2 and 3 in the formula?


    I changed this to 2 and 3 and it worked on them all, so may have been some conflict the other way. But I can't format paint these into my original file. I paste a cell and use the format painter and it shows the conditional formatting but it's not highlighting anything. Even when I try to format paint them into the original portion in the file you posted they aren't working. Am I'm missing something? And could you help with one for months that have pasted?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    The table below shows what date EOMONTH() would give from today's date, based on the "months" shown next to the dates
    S
    T
    3
    30-Apr-18
    -1
    4
    31-May-18
    0
    5
    30-Jun-18
    1
    6
    31-Jul-18
    2
    7
    31-Aug-18
    3


    As you can see, using 2 (2 months ahead), gives end of July, so dates up to end July would qualify, which, if you look at my file that I sent you, is exactly what is happening. If you need to include Aug, you would need to adjust the "month" value

  9. #9
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    I got it working, I had messed up the cell reference, sorry for the trouble. Could you give me one to highlight past months?

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    As you can see from my table in post 8, you can use negative numbers to go backwards in months.
    -2 would be Mar
    -1 would be Apr
    0 would be May
    1 would be Jun
    etc

    See if you can work it out from that, if not, give me a shout and I will assist you further

  11. #11
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    I got it working, not sure if it's the most efficient way, but it's working. I can't post the formula as I get a warning saying it's html.

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    Yes, the forum firewall sometimes thinks you are posting HTML if you use < or > without a space either side of them.
    Try posting the formula with spaces...
    =AND(C2 > =EOMONTH(TODAY(),1),C2 < =EOMONTH(TODAY(),2))

  13. #13
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    =C2 < EOMONTH(TODAY(),-2)

    This is what I figured out, it works.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Conditional formatting using months of dates

    Looks good to me, well done

  15. #15
    Registered User
    Join Date
    11-06-2017
    Location
    West Florida
    MS-Off Ver
    2016
    Posts
    15

    Re: Conditional formatting using months of dates

    THanks for the help

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Conditional Format - Dates greater than 18 months and 24 months
    By amandavan in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-03-2024, 04:08 PM
  2. [SOLVED] Conditional Formatting for Impending Dates Several Months Out
    By STABxWEST in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-03-2018, 02:31 PM
  3. Conditional Formatting to highlight 'between months'
    By shauneyd in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2017, 09:23 AM
  4. How to do Conditional Formatting for next three months
    By jcsl1g13 in forum Excel General
    Replies: 7
    Last Post: 02-22-2017, 03:00 PM
  5. Conditional Formatting using months
    By buksa in forum Excel General
    Replies: 8
    Last Post: 07-06-2014, 10:12 PM
  6. Conditional formatting for months
    By newuanda in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-13-2010, 03:12 PM
  7. Conditional Formatting - Months
    By LM100 in forum Excel General
    Replies: 22
    Last Post: 03-29-2009, 12:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1