+ Reply to Thread
Results 1 to 4 of 4

How to conditional formatting the: 1st Sunday before the 10th of the month

  1. #1
    Registered User
    Join Date
    09-23-2014
    Location
    DK
    MS-Off Ver
    2007
    Posts
    2

    How to conditional formatting the: 1st Sunday before the 10th of the month

    If I have the days (day, date/month/year) of the year listed in column B (e.g. each day for all of 2014-2015).

    What code (or codes) could I use to have the cells that contains the 1st Sunday before the 10th of the month (each month in 2014-2015) to change color. And how do I do it in conditional formatting?

    Any help would be greatly appreciated.

    /Thomas

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: How to conditional formatting the: 1st Sunday before the 10th of the month

    I know there are shorter formulas but, assuming your data starts in row 2

    =AND(WEEKDAY(B2,1)=1,DAY(B2+7)>=10,DAY(B2)-7<3)

    If you want the 10th to be highlighted when it's on a Sunday (instead of the 3rd)

    =AND(WEEKDAY(B2,1)=1,DAY(B2+7)>10,DAY(B2)-7<4)
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    09-23-2014
    Location
    DK
    MS-Off Ver
    2007
    Posts
    2

    Re: How to conditional formatting the: 1st Sunday before the 10th of the month

    It worked, but for one little thing: Saturday is highlighted instead of Sunday. Sorry I did not mention, that my data starts in row 4.
    Even if the data starts in row 2, Saturday is still highlighted.

    How do I highlight Sunday instead?

    Thank you so much, ChemistB.
    Last edited by TSKN; 09-26-2014 at 05:45 PM.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,695

    Re: How to conditional formatting the: 1st Sunday before the 10th of the month

    Sounds like you have applied the formatting from row 1

    With conditional formatting you need to ensure that the formula refers to the first row of the "applies to" range, so if your data starts from row 4, use an "applies to" range that starts at row 4 and change the formula so that it applies to row 4 too.

    Be careful changing these, changing one sometimes automatically changes the other so best to delet what you have and start again
    Audere est facere

+ 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. first sunday of a month
    By nowfalapm in forum Excel General
    Replies: 5
    Last Post: 03-20-2012, 12:12 PM
  2. Return month even if first sunday is in previous month?
    By jordiejones in forum Excel General
    Replies: 2
    Last Post: 03-22-2011, 07:54 PM
  3. Determine the date of the last Sunday in a month
    By Grimace in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-27-2011, 10:09 PM
  4. OT #5 - week ending Sunday, 10th January 2010
    By teylyn in forum The Water Cooler
    Replies: 18
    Last Post: 01-11-2010, 08:06 AM
  5. [SOLVED] Date Command to Get the Sunday Before the First of the Month
    By Minitman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-02-2005, 05:40 PM

Tags for this Thread

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