conditional formatting

QuizToon

New Member
Joined
Jan 31, 2009
Messages
28
Hi all,

I am trying to make a cell highlight in red if there are more than 1 condition present. The table below represents a work rota and also a holiday planner underneath. The initials of each employee are entered into the rota for each day they are at work. If they are on a rest day (RD) or have booked holidays (H) these are entered into the planer at the bottom. The holiday planner can be populated for the whole year in some cases whereas the rota is done around 2 weeks in advance.

With 100 employees and 25 sites to work with this can be quite a difficult task and time consuming task.

To highlight any errors would make the task much quicker to do.

Is it possible to have some conditional formatting to the rota part of the sheet.

The sequence would be - If the initials are input into the rota then a check would be made to see if the that person has either rest days or holiday booked and if so highlight the cell in a colour to highlight that fact. Each employees given initials are in the bottom part of the planner to match 2. In the instance of BF/OG, then there are 2 people working that site on that day.

I hope that is all making sense, its had my head in a spin for ages. I think I did manage to get it working for single cells and I had the conditional formatting in the planner part which was wrong.

I cant work out how to check the initials in the rota against those in the planner column and see if there is 'H' or 'RD' in the planner. The highlight needs to be in the rota part.

eg The cells with JS in the 10th and 11th against site 1, should highlight to show that JS has booked holiday those days and should not be included in the rota.

DATE
10TH
11TH
DAY
SITE 1
JS
JS
SITE 2
GP
GP
SITE3
BF/OG
BF/OG
SITE4
TR
TR
SITE 5
DB
DB
PLANNER
EMPLOYEE
INITS
1
JS
H
H
2
GP
H
3
BF
RD
RD
4
OG
5
TR
H
6
DB

<tbody>
</tbody>


Many Thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
I don't know any way to make it work with the sort order you have in your planner, except passing by Workbook_SheetChange and make some coding

But... if you can change your planner section to be sorted by INITS instead of EMPLOYEE you can use this :

Add a conditional formatting

Formula:
=IF(LEN(C5)>2,OR(VLOOKUP(C5,$B$13:$D$18,COLUMN(C5)-COLUMN($B$13)+1)<>"",VLOOKUP(RIGHT(C5,2),$B$13:$D$18,COLUMN(C5)-COLUMN($B$13)+1)<>""),VLOOKUP(C5,$B$13:$D$18,COLUMN(C5)-COLUMN($B$13)+1)<>"")
Notes, addresses are for this example, if you need to make changes
C5 is the first (top-left) cell of your ROTA INITS data (important : do not put $ sign to the new value)
$D$13 is the first (top) cell of your PLANNER INITS data
$D$18 is the last (bottom) cell of your PLANNER INITS data

Whatever formatting you want

Apply to range:
=$C$5:$D$9

Result :

Excel 2010
ABCD
1
2DATE10TH11TH
3DAY
4
5SITE 1JSJS
6SITE 2GPGP
7SITE3BF/OGBF/OG
8SITE4TRTR
9SITE 5DBDB
10
11PLANNER
12EMPLOYEEINITS
133BFRDRD
146DB
152GPH
161JSHH
174OG
185TRH
Feuil1


Have a nice day!
Den
 
Upvote 0
So if I'm reading this correctly, you want to take the name (initials) from the first table, and look it up in the second table for that date, and IF it has an H for that date, make the cell in the first table red, yes ?

If so, that's do-able fairly readily.

One thing that will make it MUCH harder is if you have multiple sets of initials in the same cell, such as "BF/OG".
That's still do-able but it's MUCH harder and I strongly recommend you don't go down that road, and instead focus on having one single name in each cell, and never more than one.

ALSO, consider what to do if you have two or more people with the same initials - John Doe and Jane Doe, and so on.
Consider listing their full name, or maybe even better, consider using unique employee reference numbers.

But as long as there are no shared initials, this can be done.

Let's make some assumptions about where all this data is.
In fact, let's assume that the data is in exactly the same cells as in TheSpiderman's post.
Select cell C5, apply a new condition, and select the option to Use a formula to determine which cells to format.

Here's the formula
=VLOOKUP(C5,$B$13:$D$18,COLUMN()-1,FALSE)="H"

and apply this to the range C5:D9.

The COLUMN()-1 bit is important to work out which column to refer to in the VLOOKUP formula - you will probably need to adjust this if your data is NOT laid out as shown.
 
Upvote 0
...Notes, addresses are for this example, if you need to make changes
C5 is the first (top-left) cell of your ROTA INITS data (important : do not put $ sign to the new value)
$D$13 is the first (top) cell of your PLANNER INITS data
$D$18 is the last (bottom) cell of your PLANNER INITS data
...
Should be
Notes, addresses are for this example, if you need to make changes
C5 is the first (top-left) cell of your ROTA INITS data (important : do not put $ sign to the new value)
$B$13 is the first (top) cell of your PLANNER INITS data
$D$18 is the last (bottom-right) cell of your PLANNER INITS data

Didn't find a way to edit my original post :(
 
Upvote 0
Hi Gerald,

Thanks for the reply. There has to be 2 sets of initials on some occasions as there will be 2 people in the site. Initials are always unique.

Going to play with yor suggestion too. See if I can understand what you have done and see if I get my head round it.

Thanks again
 
Upvote 0
Hi Spiderman,

I have this working as you said, thanks for that. I sorted by initials.

If I have the planner set out for the year will I just change the range in the formula to suit?

eg: Assuming the whole planner/rota runs right up to the end of the year and finishes on column NI45 or will this only work for the 2 columns. Don't want to try it in case I break it :)

=IF(LEN(C5)>2,OR(VLOOKUP(C5,$B$13:$NI$45,COLUMN(C5)-COLUMN($B$13)+1)<>"",VLOOKUP(RIGHT(C5,2),$B$13:$NI$45,COLUMN(C5)-COLUMN($B$13)+1)<>""),VLOOKUP(C5,$B$13:$NI$45,COLUMN(C5)-COLUMN($B$13)+1)<>"")

My rota and planner runs from I8 to NI18, the holiday part runs from I21 to NI45

the column for the initials is g21 to G45.

I really do appreciate the assistance
 
Last edited:
Upvote 0
My rota and planner runs from I8 to NI18, the holiday part runs from I21 to NI45

the column for the initials is g21 to G45.

Hi QuizToon,

Try this in I8 Conditional Formatting:

=ISNUMBER(FIND(" "&VLOOKUP(LEFT(I8,2),$G$21:$NI$45,COLUMNS($I8:I8)+2,0)&" "," H RD "))+
ISNUMBER(FIND(" "&VLOOKUP(RIGHT(I8,2),$G$21:$NI$45,COLUMNS($I8:I8)+2,0)&" "," H RD "))


EFGHIJKLMN
4
5DATE10TH11TH
6DAY
7
8SITE 1JSJS
9SITE 2GPGP
10SITE3BF/OGBF/OG
11SITE4TRTR
12SITE 5DBDB
13
18
19PLANNER
20EMPLOYEEINITS
211JSHH
222GPH
233BFRDRD
244OG
255TRH
266DB
27
************************************************

<tbody>
</tbody>


Markmzz
 
Upvote 0
...
If I have the planner set out for the year will I just change the range in the formula to suit? Yes

eg: Assuming the whole planner/rota runs right up to the end of the year and finishes on column NI45 or will this only work for the 2 columns. Don't want to try it in case I break it :)

=IF(LEN(C5)>2,OR(VLOOKUP(C5,$B$13:$NI$45,COLUMN(C5)-COLUMN($B$13)+1)<>"",VLOOKUP(RIGHT(C5,2),$B$13:$NI$45,COLUMN(C5)-COLUMN($B$13)+1)<>""),VLOOKUP(C5,$B$13:$NI$45,COLUMN(C5)-COLUMN($B$13)+1)<>"")

My rota and planner runs from I8 to NI18, the holiday part runs from I21 to NI45

the column for the initials is g21 to G45.

I really do appreciate the assistance

Based on what you said you have to change also C5 for I8 and $B$13 for $G$21 like this :

=IF(LEN(I8)>2,OR(VLOOKUP(I8,$G$21:$NI$45,COLUMN(I8)-COLUMN($G$21)+1)<>"",VLOOKUP(RIGHT(I8,2),$G$21:$NI$45,COLUMN(I8)-COLUMN($G$21)+1)<>""),VLOOKUP(I8,$G$21:$NI$45,COLUMN(I8)-COLUMN($G$21)+1)<>"")

and apply to range:
=$I$8:$NI$18

Have fun!
Den
 
Upvote 0

Forum statistics

Threads
1,214,572
Messages
6,120,306
Members
448,955
Latest member
Dreamz high

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top