+ Reply to Thread
Results 1 to 10 of 10

conditional formatting formula for cell value of previous month and keep clear for blank

  1. #1
    Forum Contributor
    Join Date
    07-20-2007
    MS-Off Ver
    2016, 365
    Posts
    127

    conditional formatting formula for cell value of previous month and keep clear for blank

    Hi All
    I created conditional formatting:
    CF_date.png
    Right now the column D is blank but all cells in the column color
    How create conditional formatting to color only if date value in the column is previous month or early?

    Thanks
    Last edited by eugz; 09-05-2022 at 08:14 PM.

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Try this

    =AND(YEAR($D2)<=YEAR(TODAY()),MONTH($D2)<MONTH(TODAY()))
    Last edited by kvsrinivasamurthy; 09-05-2022 at 11:17 PM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Contributor
    Join Date
    07-20-2007
    MS-Off Ver
    2016, 365
    Posts
    127

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Hi kvsrinivasamurthy. Thanks for reply.
    Your conditional formatting has the same problem like and my. It continue fill coloring cell if cell blank also. I try to formatting only if cells have value.

    Thanks

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Please try =AND(D2>0,D2<DATE(YEAR(D2),MONTH(D2),1))

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Try

    =AND($D2<>"",YEAR($D2)<=YEAR(TODAY()),MONTH($D2)<MONTH(TODAY()))

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    @kvsrinivasamurthy

    I think your formula doesn't always work well.
    If D2 = December 15, 2021 then the formula returns FALSE,
    because the month of December is not smaller than today's month (September),
    but December 2021 is still ahead of today.

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Try this
    Please Login or Register  to view this content.
    If result is not ok then, pl upload sample file showing the required results.
    Last edited by kvsrinivasamurthy; 09-06-2022 at 07:55 AM.

  8. #8
    Forum Contributor
    Join Date
    07-20-2007
    MS-Off Ver
    2016, 365
    Posts
    127

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Hi HansDouwe. Thanks for reply.
    Your formula remove color for blank cells but it also remove color from cells with date value earlier last month. For instance, if date value 8/1/2022 a cell has color, but if cell value 7/31/2022 or earlier condition doesn't work. I used for last month condition rule: "Format only cells that contain", "Date Occurring", and "Last month". My problem create formula condition for date value earlier then last month and remine not color cells with blank value.

    Thanks

  9. #9
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,831

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Try:

    =AND($D2<=EOMONTH(TODAY(),-1),$D2<>"")

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: conditional formatting formula for cell value of previous month and keep clear for bla

    Quote Originally Posted by eugz View Post
    Hi HansDouwe. Thanks for reply.
    Your formula remove color for blank cells but it also remove color from cells with date value earlier last month.
    Thanks
    My formula is not meant to remove color, my formula is meant to set the color right away.
    My formula should take the place of your formula, but not next to it.
    If you upload an example sheet I'll show you that.

+ 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. Match cell color to range that uses conditional formatting color scales
    By pc2011 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2022, 09:37 AM
  2. conditional formatting and color cells with formula
    By langeloo in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 05-27-2021, 04:39 PM
  3. Conditional Formatting - Color Formatting for Blank Cells
    By mlbdc2012 in forum Excel General
    Replies: 10
    Last Post: 02-10-2015, 06:28 AM
  4. Replies: 5
    Last Post: 07-27-2014, 04:43 AM
  5. Replies: 3
    Last Post: 05-30-2014, 10:24 AM
  6. Replies: 5
    Last Post: 12-31-2013, 01:44 AM
  7. Replies: 2
    Last Post: 07-01-2013, 05:01 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