+ Reply to Thread
Results 1 to 5 of 5

Formula or Conditional Formatting not Performing Properly.

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    2

    Question Formula or Conditional Formatting not Performing Properly.

    Let me start by stating that I believe I am in the right place with this question, but I am uncertain where exactly the problem lies.

    I am working on a Gantt chart and am trying to utilize an "if" "or" and "weekday" formula to highlight non work days. I have a date field spanned vertically from row 3 - 6 and the dates start in column H and continue to column AY. The date in column H is 02/16/15, column I is 02/17/15 and so on. I am using the formula -- =IF(OR(WEEKDAY(H$3)=1,WEEKDAY(H$3)=7),1,0) -- so if the day value returned is 1 or 7 (Sunday or Saturday) the true statement reads 1 and false reads 0.

    Spanning this formula across row 30 from column H - AY I get "00000110000011000001100000110000011000001100". This is the expected result 5 zero's and 2 one's per week.

    The trouble is, when I apply this formula to conditional formatting to apply a color fill on the dates that fall in the weekend everything works properly until column AS and then everything after AS is color filled as if it were a weekend.

    Any thoughts?

    Project Overview_Need Help.xlsx

    Sean May
    Last edited by Dilusive; 02-21-2015 at 10:16 PM.

  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
    52,926

    Re: Formula or Conditional Formatting not Performing Properly.

    Hi, welcome to the forum

    To begin with, your CF was usingthe wrong reference...
    =IF(OR(WEEKDAY(H$3)=1,WEEKDAY(H$3)=7),1,0)

    2nd, you can shorten that by modifying your WEEKDAY() function to just this in your CF...
    =WEEKDAY(H$3,2)<6
    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
    08-27-2012
    Location
    FL
    MS-Off Ver
    Excel 2013
    Posts
    2

    Re: Formula or Conditional Formatting not Performing Properly.

    This is so strange. I had checked the conditional formatting several times, not sure how the H was replaced with an O. Nevertheless the issue has been resolved by correcting the reference.

    With regard to the shortened formula, thank you! It makes a lot of sense to shorten. I had to instead use =WEEKDAY(H$3,2)>5 so that the weekend was highlighted and not the weekday.

    Thanks as well for the welcome, I have been a long time observer, this would just happen to be my first post.

    And one final thank you for the help.

  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
    52,926

    Re: Formula or Conditional Formatting not Performing Properly.

    With regard to the shortened formula, thank you! It makes a lot of sense to shorten. I had to instead use =WEEKDAY(H$3,2)>5 so that the weekend was highlighted and not the weekday.
    I had a feeling I had it the wrong way round, but it got you headed in the right directyion

    Note that FC rules are bases on ONLY TRUE or FALSE, so you dont need to include your test in an IF() statement - which also produces a TRUE or FALSE result
    Also, its a good idea to take not of the (generally) last argument in functions - it often gives you many more options

    Anyway, Im glad we got you where you wanted to be

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Formula or Conditional Formatting not Performing Properly.

    Quote Originally Posted by Dilusive View Post
    This is so strange. I had checked the conditional formatting several times, not sure how the H was replaced with an O
    Did you change the "applies to" range? Adjusting that range can change the formula, e.g if your range started at col A and you changed it to start at Col H then formula refs will change by 7 columns, i.e. H to O

    If you change the applies to range then always check the formula afterwards
    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. Checkbox VB code isnt performing properly
    By mshaneweaver in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-20-2014, 03:38 PM
  2. [SOLVED] Conditional formatting formula cell reference not incrementing properly
    By killerthun in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-23-2014, 07:29 PM
  3. Conditional Formatting Formula Not Working Properly
    By Oscar Martin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-23-2014, 08:59 AM
  4. Conditional formatting not working properly
    By mlucey01 in forum Excel General
    Replies: 4
    Last Post: 01-08-2013, 08:35 PM
  5. [SOLVED] Conditional formatting does not function properly
    By kelwood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2012, 12:29 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