Geralt745
Geralt745

Reputation: 107

Excel - highlight date range within another date range

Working on a booking system on Excel, I have two components to make it works:

Tab1 - The booking system itself showing from which date range any element is booked (eg, Element A booked from the 21/10/2014 to the 28/10/2014),

Tab2 - A calendar highlighting availability for each booking

Currently, the calendar stresses whether an element is available or not and highlight conflict (booking at the same date) for a given element.

What I would like to add is a sort of error message (or color conditional formatting) within the booking system (Tab 2) if two elements are overlapping. Eg. element A booked from the 21/10/2014 to the 28/10/2014 and element B booked from the 26/10/2014 to the 30/10/2014.

Problem is that I have not been able to add this type of conditional formatting since it depends on a date range.

Link to the file: https://www.dropbox.com/s/ehwckfr9d3iknca/Booking%20system.xls?dl=0

Any help would be greatly appreciated!

Thanks, Geralt

Upvotes: 1

Views: 380

Answers (1)

ZAT
ZAT

Reputation: 1347

Try this:

Select Booking sheet > select C or D column cell to apply formatting > Conditional Formatting > New Rule.

Add two Rules for two columns. Use a formula to determine which cells to format should be selected.

Formula for two columns are :

=C4<=OFFSET(C4;-1;1) and =D3>=OFFSET(D3;1;-1)

Special attention :

a. C4 and D3 as starting of formatting b. Ranges onto which these are applied.

See the image below to get the idea:

enter image description here

Upvotes: 1

Related Questions