I had a couple of hiccups as my lettering system is not as straight forward as the original example (the letters are shifts on a schedule which is why morning shifts can't follow evening or overnight shifts for the same person)
I also have a couple of 2 letter shifts N2 and F2. F2 can't be followed by any of the morning shifts including F, and N2 can't be followed by any shifts except N, M, and N2.
Morning shifts D, Z, G, B, F Q: Evening shifts A, U, T, P E, H: Night shifts N, M, N2: afternoon through evening shift F2
I ended up using 3 conditional formatting statements based on Phuocam's suggestion.
Since N2 is a night shift I modified the original formula to
Formula:
=(LEN(B5)>=1)*(LEN(C5)>=1)*FIND(B5,"AUTHPENMN2")*FIND(C5,"DZFBGQ")
To cover night shifts not being followed by evening shifts either
Formula:
=(LEN(B5)>=1)*(LEN(C5)>=1)*FIND(B5,"NMN2")*FIND(C5,"AUTHPEF2")
And to cover the shifts that can't follow F2 which includes F
Formula:
=(LEN(B5)=2)*(LEN(C5)=1)*FIND(B5,"F2")*FIND(C5,"DZFBGQ")
Not sure if there is anyway to combine these statements.
I tried using an array but got an error that it couldn't be used in CF.
Thanks again,
Stuart
Bookmarks