+ Reply to Thread
Results 1 to 13 of 13

Conditional formatting/formula query

  1. #1
    Registered User
    Join Date
    05-18-2021
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    12

    Conditional formatting/formula query

    Cross-posted at https://www.mrexcel.com/board/thread...-this.1215670/

    Hi,

    I have created a Rota sheet where a number of tasks can be allocated to staff members. Tasks are split in half so they can be carried out AM and/or PM, either by a single member of staff or multiple staff members.

    You can specify the number of staff required to carry out the task. Once that allocated number has been reached, the task will highlight in green in the Daily Tasks list on the right of the sheet.

    In the sheet, for Base 1, the required amount of staff for Task D is 2 (i.e. 2 staff for AM and 2 staff for PM). The Daily Total is highlighting green even though Task D is allocated to 3 staff members during AM. Base 2 shows this correctly, where Task 3 is allocated between 2 staff members and split evenly across AM and PM.

    Is there a way to only highlight those tasks correctly? Any help would be gratefully appreciated.

    Thanks in advance,
    Mark.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 09-05-2022 at 04:51 PM. Reason: added xpost link

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    I have added the link to your post since you are a new member. Please review the rules.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-18-2021
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    12

    Re: Conditional formatting/formula query

    Apologies. Thanks for adding the link. Any help would be appreciated.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    Even though what you are trying to do sounds simple, I am having trouble mapping your description to what I see in your file.

    What is a "Base"?

    How do you know the required amount of staff for a Base/Task/AM-PM?
    In the sheet, for Base 1, the required amount of staff for Task D is 2 (i.e. 2 staff for AM and 2 staff for PM).
    I don't see how you can tell this from the file.

    I think it would help if you gave more of a walkthrough about how your file works. Remember, you know all about it, but we've never seen it before and don't know anything about what you are doing except what you put in your post.

  5. #5
    Registered User
    Join Date
    05-18-2021
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    12

    Re: Conditional formatting/formula query

    Base 1 and Base 2 are the names of two different office locations where staff are based. Tasks A-D are covered by staff at Base 1 and tasks 1-4 are covered by staff at Base 2. The number of staff required for each task is entered into column T. Each task requires to be covered in the mornings (AM) and afternoons (PM).

    If Task 3 requires 2 members of staff for the day then '2' is entered into cell T4. 'Task 3' is entered in cells G2 and I2 (allocated to Person 1 for the whole day). This counts as 1 task allocation. 'Task 3' is entered into cell G5 (allocated to Person 2 for the morning only). As Person 2 isn't covering the task for the whole day, this counts as half a task allocation. It means another member of staff needs to be allocated Task 3 for the afternoon. 'Task 3' is entered into cell I8 (allocated to Person 3 for the afternoon). This again counts as half a task allocation. Task 3 is now effectively covered for the whole day.

    I have formulas in cells S2-S9 and U2-U9 which calculate when a task has been allocated, and conditional formatting in place in cells R2-R9 which enable the cells where Tasks have been fully allocated to highlight in green. Otherwise they stay red. This works fine.

    However, if we swap around the Tasks for Person 3 ('Task 3' is entered into cell G8 and 'Task 4' into cell I8) it still calculates that Task 3 is covered for the whole day (and highlights in green), when in fact we have Person 2 and Person 3 covering the Task in the morning and no effective 2nd member of staff covering the Task in the afternoon.

    I hope that makes more sense. Any questions, please just ask.

    Thank you.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    Your design is rather complicated for what you are doing and I suspect that is because you designed it for how it will look rather than the relationships among the data. This requires you to duplicate all your conditional formatting rules. For example, for a cell to be green you have separate rules for each cell in column R. I am not going to offer a redesign here but just try to offer a patch for the problem you have.

    I have replaced the formulas in column U, and removed the redundant rules for green in column R with a single rule that works for every row. This also resolves the #VALUE errors you were getting.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-18-2021
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    12

    Re: Conditional formatting/formula query

    Yes, the design wasn't my idea but the powers that be want it to look like that. Your new formula works a treat :-) Many, many thanks 6StringJazzer for your help. Fantastic!

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    Glad to help! You can rewrite the CF rules for black to one rule, following the same example as the one I did for green, if it's worth the bother for you.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

  10. #10
    Registered User
    Join Date
    05-18-2021
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    12

    Re: Conditional formatting/formula query

    Quote Originally Posted by 6StringJazzer View Post
    Glad to help! You can rewrite the CF rules for black to one rule, following the same example as the one I did for green, if it's worth the bother for you.
    Sorry, I should've mentioned that a black background denotes when a task has been over-allocated. For example, if Task 1 requires 3 staff but has been allocated to 4 members of staff, that's when it's highlighted. I've tried =$S2<0 but it doesn't work. What's the best Conditional Formatting rule for this?

    Thanks in advance.
    Last edited by markmcm2021; 09-07-2022 at 04:41 AM.

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    My solution counts the total number of shifts assigned and ensures that the minimum is met. It doesn't check for being over the minimum. The easiest way to do this is with a separate formula. (It might be possible to do all of this with a single formula but using two is easier to write and easier to understand.)

    Column S is not required. I have updated the green rule to compare T and U. (If you wanted to, you could even eliminate the formula in column U and put the logic into the CF rule.)

    I have added a formula in column V and modified a single black rule to check it.

    Note that you can have a situation where one shift is overallocated and another is underallocated. In this particular file, that is Task D overallocated in AM. You get a black cell in this case. Once you resolve the overallocation, the cell will turn red to show you are underallocated for PM.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    05-18-2021
    Location
    Scotland
    MS-Off Ver
    2007
    Posts
    12

    Re: Conditional formatting/formula query

    Thank you so much 6StringJazzer! This is absolutely perfect :-)

  13. #13
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Conditional formatting/formula query

    You're welcome!

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

+ 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 IF Query
    By KINGOFCHAOS17 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-25-2021, 11:47 AM
  2. Conditional Formatting query
    By Catflappo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-16-2017, 08:24 PM
  3. Yet another conditional formatting query
    By GerryExcel in forum Excel General
    Replies: 9
    Last Post: 01-03-2016, 07:37 PM
  4. Conditional Formatting Query
    By pvwebster in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2015, 11:43 PM
  5. [SOLVED] Conditional formatting formula query
    By fumusic in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-02-2014, 07:03 PM
  6. [SOLVED] Conditional Formatting Query
    By artikyulashun in forum Excel General
    Replies: 2
    Last Post: 05-16-2013, 07:47 PM
  7. Conditional Formatting Query
    By Chris Mizon in forum Excel General
    Replies: 2
    Last Post: 03-13-2012, 08:42 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