+ Reply to Thread
Results 1 to 17 of 17

Conditional Formatting by formula - need assistance

  1. #1
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Conditional Formatting by formula - need assistance

    Hello Pros,

    I have over the years I've learned much from this site, only this time I think I actually have to post a question as I am in need for a specific answer.

    I have made an employee schedule, I have all the coding down to do exactly what I need it for. Upon its implementation my team did not like that I got rid of the color fills for each cell that were associated with their shifts. I didn't want to make a separate sheet and list all the possible combinations of shifts to determine which color to code the cell then refer back to that sheet as I had done in the past. That process was searching for a specific shift and would color it. But if i made an odd shift such as 8a -9a it would not know what to do as it was not a defined shift.

    On my new schedule I wanted to use conditional Formatting to search the cell for the first 3 characters/number and determine it as a start time for a shift. Using an defined table that I called "ShiftData" the formula was to search the cell and find the start time and search the table "ShiftData" for a shift code. From that shift code it would know to color all cells that color. I don't know if this is the easiest way or not, I was recycling code i used on my old schedule to make it work, only conditional formatting will not do what i want no matter how i code it. This is where i need help.

    This is the code that has been giving me the best results only its coloring everything else but what should be that color:
    =IF(B14="OFF","0",IF(B14="R/OFF","0",IFERROR(VLOOKUP(SUBSTITUTE(SUBSTITUTE(LEFT(B14,3)," ","",1),"-",""),ShiftData,2,FALSE),0)))

    If I had this in a cell it would work and give me the 1A result, so i know the formula works, i just don't know how to get it to apply to conditional formatting so that all 1A shifts are colored yellow.
    Any assistance would be greatly appreciated.
    Attached Files Attached Files
    Last edited by Kamico; 08-11-2017 at 01:30 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    Where in your attachment does it show what you want the sheet to look like? Is there a key somewhere?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    =IF(B14="OFF","0",IF(B14="R/OFF","0",IFERROR(VLOOKUP(SUBSTITUTE(SUBSTITUTE(LEFT(B14,3)," ","",1),"-",""),ShiftData,2,FALSE),0)))

    When creating conditional formatting rules, you need rules that give a TRUE or FALSE result. What, in WORDS, are you expecting this formula to do - step-by-step, please.

  4. #4
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    Thank you for your fast reply.
    I have included a new sheet with what i was hoping conditional formatting would show. On each of the sheets (exception of the example) there is a different result from codes i have tried.
    If you know of a better way, well actually a way that works as mine doesnt, i would love your assistance.

    Thank you
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    Thanks! That gets us halfway there. I found this:

    Excel 2016 (Windows) 32 bit
    C
    D
    E
    F
    G
    H
    67
    Shift Data
    68
    1A
    5
    69
    2A
    5
    Morning
    1A
    70
    3A
    5
    Mid-Day
    2A
    71
    4A
    5
    Evening
    3A
    72
    5A
    1A
    Pre-Audit
    4A
    73
    6A
    1A
    Audit
    5A
    74
    7A
    1A
    75
    8A
    1A
    76
    9A
    2
    77
    10A
    2
    78
    11A
    2
    79
    12P
    2
    80
    1P
    3
    81
    2P
    3
    82
    3P
    3
    83
    4P
    3
    84
    5P
    4
    85
    6P
    4
    86
    7P
    4
    87
    8P
    4
    88
    9P
    4
    89
    10P
    5
    90
    11P
    5
    91
    12A
    5
    Sheet: Expected Look

    Could you please explain it and how I apply it to the actual data to decide on the colour? I need to understand the logic before I can create a rule.

  6. #6
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    im looking for the conditional formatting color (fill) a cell based on its start time. Example (7a - 3p)
    1 - find the start time of the shift. (7a)
    2- see what shift that should be colored using the ShiftData table (7a = Morning Shift = yellow)
    3- apply yellow if shift is classified as morning.

    I will be using this for all 5 shift types which are listed starting in H69. The ShiftData table is defining each start time as a shift. I need the conditional formatting to determine which to color which based only on the start time of the shift.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    Right - OK, I think I understand. Give me a few minutes to work on this.

  8. #8
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    My appologies, i just realized i never finished while i was testing the morning shifts. the values should resemble this, i left out the "A" on the other shifts.
    Attached Images Attached Images

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    OK, so you've changed things a bit since I've been working on this.

    Yellow is:

    =OR(LEFT(B11,2)="5A",LEFT(B11,2)="6A",LEFT(B11,2)="7A",LEFT(B11,2)="8A")

    Blue:

    =OR(LEFT(B11,2)="9A",LEFT(B11,3)="10A",LEFT(B11,3)="11A",LEFT(B11,3)="12P")

    Green:

    =OR(LEFT(B11,2)="1P",LEFT(B11,2)="2P",LEFT(B11,2)="3P",LEFT(B11,2)="4P")


    Dark blue:

    =OR(LEFT(B11,2)="5P",LEFT(B11,2)="6P",LEFT(B11,2)="7P",LEFT(B11,2)="8P")

    Mauve:

    =OR(LEFT(B11,3)="12A",LEFT(B11,2)="1A",LEFT(B11,2)="2A",LEFT(B11,2)="3A",LEFT(B11,2)="4A")


    All need applying to the range =$B$11:$H$40
    Last edited by AliGW; 08-11-2017 at 01:22 AM. Reason: Added the rest of the rules.

  10. #10
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    Thank you Ali,
    I have plugged the formula into Conditional Formatting and it does not seem to do it.
    edit rule.jpg
    Does this look right?

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    Yes. It works here. Did you apply it to the range =$B$11:$H$40?

  12. #12
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    Yes, hmm. I don't know what I am doing wrong then.
    rules.jpg

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    Please attach a new version of the file with your attempt - I can't troubleshoot screenshots!

  14. #14
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    My apologies.
    Attached Files Attached Files

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    OK - lots of things wrong. Edit it again and make sure that all that is in the yellow rule is this (other rules listed above):

    =OR(LEFT(B11,2)="5A",LEFT(B11,2)="6A",LEFT(B11,2)="7A",LEFT(B11,2)="8A")

    At the moment you have two = and too many " - it must be EXACTLY as the above - copy and paste it in.

  16. #16
    Registered User
    Join Date
    02-03-2015
    Location
    Daytona Beach, Florida, USA
    MS-Off Ver
    Office 2013 Professional
    Posts
    8

    Re: Conditional Formatting by formula - need assistance

    You're the best!
    I can't thank you enough. I spent nearly 2 weeks on this.
    Thank you!

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,288

    Re: Conditional Formatting by formula - need assistance

    You're welcome!

    Glad we got there in the end ...

+ 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. Conditional Formatting Formula Assistance
    By SH1988 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-03-2017, 07:26 AM
  2. Conditional Formatting Assistance
    By jharvey87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2017, 02:36 PM
  3. [SOLVED] Conditional Formatting Formula Syntax Assistance
    By robertguy in forum Excel General
    Replies: 3
    Last Post: 06-22-2016, 06:34 AM
  4. conditional formatting assistance? HELP!
    By TRAZ6666 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-31-2016, 03:01 PM
  5. Conditional Formatting Assistance
    By St34d in forum Excel General
    Replies: 3
    Last Post: 03-25-2015, 04:43 PM
  6. [SOLVED] Simplifying Conditional Formatting - Formula Assistance Please
    By xkittenxx in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-19-2012, 08:57 PM
  7. Conditional Formatting Formula Assistance
    By chiasmus811 in forum Excel General
    Replies: 7
    Last Post: 06-20-2011, 09:26 AM

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