I can not use conditional formatting in Excel 2016 for Mac because the formula is too long

renpilot

New Member
Joined
Dec 4, 2023
Messages
28
Office Version
  1. 2016
Platform
  1. MacOS
Hello all,

I am running Excel 2016 for Mac.

I found an old thread in the forum stating that conditional formatting can only contain 256 characters. It was from2010 so I would like to verify this is still the case?

If "yes" I have a major problem in a calendar system I have created to show bookings by A,B C,D or E. I want any cell in a year to change colour if one of 45 date ranges are true. See screenshot.

Example: A has a booking from 1/1/24 to 7/1/24 so the colour of these dates in the calendar should change colour. The same with B,C,D or E. The dates are entered as start date and end date in separate named ranges. At the bottom is an example of a formula that returns a value of true for the named ranges OURA1:OURB10 in a normal cell but can not fit in the conditional formatting formula field because it allegedly is too long.
B, C and D also has 10 possible date inputs. E has 5 possible date inputs, so all in all a lot of possible date ranges with Start Date and End Date to be checked.
The conditional formatting works with a smaller number of date entries, but when the formula gets above the 256 character length I can't write any more arguments in the conditional formatting formula field (in other words it is full).

Any help regarding how to solve this is appreciated :)

=OR(AND(B2>=OURA1;B2<=OURB1;B2<>"";OURA1<>"";OURB1<>"");AND(B2>=OURA2;B2<=OURB2;B2<>"";OURA2<>"";OURB2<>"");AND(B2>=OURA3;B2<=OURB3;B2<>"";OURA3<>"";OURB3<>"");AND(B2>=OURA4;B2<=OURB4;B2<>"";OURA4<>"";OURB4<>"");AND(B2>=OURA5;B2<=OURB5;B2<>"";OURA5<>"";OURB5<>"");AND(B2>=OURA6;B2<=OURB6;B2<>"";OURA6<>"";OURB6<>"");AND(B2>=OURA7;B2<=OURB7;B2<>"";OURA7<>"";OURB7<>"");AND(B2>=OURA8;B2<=OURB8;B2<>"";OURA8<>"";OURB8<>"");AND(B2>=OURA9;B2<=OURB9;B2<>"";OURA9<>"";OURB9<>"");AND(B2>=OURA10;B2<=OURB10;B2<>"";OURA10<>"";OURB10<>""))
 

Attachments

  • Screenshot 2023-12-08 at 00.46.08.png
    Screenshot 2023-12-08 at 00.46.08.png
    34 KB · Views: 19
Last edited:

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Much simpler if you put all your bookings into the one range:

ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAI
1
2BookingStartEnd
3A1 Jan 20247 Jan 2024
4B10 Jan 202412 Jan 2024
5C13 Jan 202414 Jan 2024
6D20 Jan 20242 Feb 2024
7
8
9January12345678910111213141516171819202122232425262728293031
10
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
D9:AH9Expression=SUMPRODUCT(--(D9>=$B3:$B6),--(D9<=$C3:$C6))textNO
 
Upvote 0
Maybe something like this?

Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAI
101020304050607080910111213141516171819202122232425262728293031StartEnd
21/3/20241/6/2024
31/9/20241/10/2024
41/15/20241/15/2024
5
Sheet3
Cell Formulas
RangeFormula
B1:AE1B1=A1+1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:AE1Expression=SUM((A1>=$AG$2:$AG$4)*(A1<=$AH$2:$AH$4))textNO
 
Upvote 0
Thank you for replying.

I can see what you mean - it is simpler, but what I need is the different colour coding to give the overview. I need A, B, C, D and E to have different colours. So in case there are bookings - and also more than one from each of A, B, C, D, and E and up to a total of 45 - they show in the overview calendar as dates with different colours. I am thinking this means I have to do an ARRAY maybe as there are 12 months listed below each other?
First test if there is a booking from either A, B, C, D or E and if so assign a specific colour?
Or I could have several conditional formattings for the same range?
 
Upvote 0
I tried your second formula, but it also colours blank fields outside the calender. I have blanks as the month do not start and end on the same weekday. See attached screenshots. The green dates you see is an attempt to show holidays also if there is no booking. This particular conditional formatting works.
 

Attachments

  • Screenshot 2023-12-08 at 11.05.14.png
    Screenshot 2023-12-08 at 11.05.14.png
    25.1 KB · Views: 8
  • Screenshot 2023-12-08 at 11.07.08.png
    Screenshot 2023-12-08 at 11.07.08.png
    23.1 KB · Views: 8
  • Screenshot 2023-12-08 at 11.08.09.png
    Screenshot 2023-12-08 at 11.08.09.png
    43.9 KB · Views: 8
Upvote 0
You can include different colours like this:

ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAI
1
2BookingStartEnd
3A1 Jan 20247 Jan 2024
4B10 Jan 202412 Jan 2024
5A13 Jan 202414 Jan 2024
6C20 Jan 20242 Feb 2024
7A5 Feb 20246 Feb 2024
8B16 Feb 202421 Feb 2024
9
10January12345678910111213141516171819202122232425262728293031
11February1234567891011121314151617181920212223242526272829
12
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:C8Expression=$A3="C"textNO
A3:C8Expression=$A3="B"textNO
D10:AH11Expression=INDEX($A$3:$A$8,MATCH(1,(D10>=$B$3:$B$8)*(D10<=$C$3:$C$8),))="C"textNO
D10:AH11Expression=INDEX($A$3:$A$8,MATCH(1,(D10>=$B$3:$B$8)*(D10<=$C$3:$C$8),))="B"textNO
A3:C8Expression=$A3="A"textNO
D10:AH11Expression=INDEX($A$3:$A$8,MATCH(1,(D10>=$B$3:$B$8)*(D10<=$C$3:$C$8),))="A"textNO

If you post your own screenshots, please use the XL2BB - Excel Range to BBCode add-in. Then we can easily copy/paste your data and formulae.
 
Upvote 0
I have downloaded the add-on and enabled macros in Excel 2016 for Mac, but the buttons are still greyed out, so unable to upload mini sheet. See screenshot.

I got it to work with conditional formatting with this formula x 5 for each of the 5 possible entries I need:
=SUMPRODUCT(($AO$3:$AO$32="S&R")*($AP$3:$AP$32<=B2)*($AQ$3:$AQ$32>=B2))>0

However I would really like if it would be possible to have 50/50 colouring in a cell if it is booked by to parties. That means half the cell with the colour for eg S&R and the other half of the cell with the colour for eg C&B. I have tried a number of VBA codings but it does not work. Should I post this particular question somewhere else in the forum?

1702117358448.png
 

Attachments

  • Screenshot 2023-12-09 at 11.25.23.png
    Screenshot 2023-12-09 at 11.25.23.png
    23.4 KB · Views: 5
Upvote 0
I also got the two coloured format to work in a slightly different way by using conditional formatting:
=AND(SUMPRODUCT(($AO$3:$AO$32="S&R")*($AP$3:$AP$32<=B2)*($AQ$3:$AQ$32>=B2))>0;SUMPRODUCT(($AO$3:$AO$32="C&B")*($AP$3:$AP$32<=B2)*($AQ$3:$AQ$32>=B2))>0)

See screenshot
 

Attachments

  • Screenshot 2023-12-09 at 14.17.52.png
    Screenshot 2023-12-09 at 14.17.52.png
    12 KB · Views: 7
Upvote 0
I also got the two coloured format to work in a slightly different way by using conditional formatting:
=AND(SUMPRODUCT(($AO$3:$AO$32="S&R")*($AP$3:$AP$32<=B2)*($AQ$3:$AQ$32>=B2))>0;SUMPRODUCT(($AO$3:$AO$32="C&B")*($AP$3:$AP$32<=B2)*($AQ$3:$AQ$32>=B2))>0)
This might work, but you've hard-coded "S&R" and "C&B". What about the other possible permutations?

However I would really like if it would be possible to have 50/50 colouring in a cell if it is booked by to parties.
When you say two parties, do you mean something like this, where a booking turns over in the middle of the day?

ABCDEFGHIJKLMNOPQRS
1
2BookingStartEnd
3A2 Jan 202410 Jan 2024
4B10 Jan 202413 Jan 2024
5C13 Jan 202415 Jan 2024
6
7January12345678910111213141516
8
9
10
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:C5Expression=$A3="C"textNO
A3:C5Expression=$A3="B"textNO
A3:C5Expression=$A3="A"textNO


That's easily accommodated:

Format row 9 if Date>StartDate and Date<=EndDate
Format row 10 if Date>=StartDate and Date<EndDate

Or perhaps you want something more like this:

ABCDEFGHIJKLMNOPQRSTU
1
2BookingUnitStartEnd
3A12 Jan 202412 Jan 2024
4B210 Jan 202416 Jan 2024
5C113 Jan 202415 Jan 2024
6
7January1234567891011121314151617
8Unit 1
9
10Unit 2
11
12
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A3:D5Expression=$A3="C"textNO
A3:D5Expression=$A3="B"textNO
A3:D5Expression=$A3="A"textNO


If so, you'll just need another condition (i.e. check whether Unit = 1 or Unit =2) into your formulae.
 
Upvote 0
Thank you for your input. I have done some more research and it seems that the 50/50 colouring of 1 cell can can only be done with VBA coding.

I also had to revise my solution to only show overlaps for two people.
The way I have set it up now is actually ok and works for me with the different colours for different people and a third colour for overlapping bookings in the same line of dates which gives the overview I need:)

Thanks again (y)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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