+ Reply to Thread
Results 1 to 7 of 7

Conditional formatting IF

Hybrid View

  1. #1
    Registered User
    Join Date
    10-11-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Thumbs up Conditional formatting IF

    Hello - I am new to the forum and am hoping someone could help.
    I am trying to perform conditional formatting based on a formula with a few components. Although I am happy to break this up into seperate conditions if that is easier.

    In short, I have a start date (B2), end date (c2), and a yes/no column (D2). I want the conditional formatting to look at a row of calendar date (E1, F1, G1...) and fill them with color based on whether the calendar dates fall between the start and end date. Furthermore, IF omplete (D2) = yes, I would want one color. IF complete (D2) = no I would want a different color. (the colors themselves dont matter - i just want to distinguish them.

    I imagine this is relatively simple...I just cant seem to nail it. Any help is appreciated.

    Capture.PNG

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Conditional formatting IF

    Select the cells that you want this to apply to, from E2 across to however many columns you need and down however many rows that you have. Then click on Conditional Formatting | New Rule | Use a formula ... (from the bottom of the list), and then enter this formula in the dialogue box:

    =AND(E$1>=$B2,E$1+1<=$C2,$D2="Yes")

    Then click on the Format button | Fill tab and choose your colour for the Yes condition (grey). Then OK your way out. With those cells still selected, repeat for the other condition, using this formula:

    =AND(E$1>=$B2,E$1+1<=$C2,$D2="No")

    and this time choose blue for the fill colour and OK your way out. Excel will automatically adjust the cell references to suit the selected cells.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    10-11-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Conditional formatting IF

    Awesome! Thanks.
    How about if I wanted to add one more condition, so I could add another color (red), that would indicate if the end date (c2) was in the past (<today) AND not yet complete (D2 = "no" ). Technically I have a cell that indicates todays date...but I am happy to use today() if easier. Capture2.PNG

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Conditional formatting IF

    Rather than attach pictures of an Excel workbook, why not attach the workbook itself then I can put it in there for you and post back?

    (Although you should be able to work it out from the above - you have two conditions in the AND function, like before).

    Pete

  5. #5
    Registered User
    Join Date
    10-11-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Conditional formatting IF

    Sorry - like I said I'm new :-) I didnt see the option to add a file (only an image). Here you go
    Example.xlsx
    This is a sample of the data (its a simplified version of a much larger spreadsheet I am working on).

    I realize this should be straight forward...I just have a mental block for some reason.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,412

    Re: Conditional formatting IF

    Okay, well you will learn more if you actually do it yourself, so follow the instructions above and use this formula:

    =AND(E$1<TODAY(),$D2="no")

    and choose red for the background. Note that you only have two conditions within the AND function this time, separated by a comma, whereas for the other formulae there were 3. Note also where the $ symbols are in the formula (and the previous ones) - these prevent that part of the cell reference from changing when the formula is applied in other cells, so basically we want to compare the date which is always on row 1, and compare the contents of column D always.

    Hope this helps.

    Pete

  7. #7
    Registered User
    Join Date
    10-11-2013
    Location
    Syracuse, NY
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Conditional formatting IF

    I totally agree - i'm trying to learn. And i get what you have here...my issue is that I think I need 4 conditions...the original 3 and then adding the condition if the end date less then today. That way it only highlights the cells between the two corresponding dates (start and end) with the red (to indicate its past due).

+ 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. Replies: 1
    Last Post: 09-20-2013, 06:23 PM
  2. Replies: 2
    Last Post: 09-19-2013, 10:34 AM
  3. Delete Conditional Formatting conditions but keep cell formatting - Excel 2010
    By tetreama in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-09-2012, 08:28 PM
  4. Replies: 3
    Last Post: 05-15-2012, 04:13 PM
  5. Replies: 1
    Last Post: 03-05-2012, 06:20 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