简体   繁体   English

Excel-突出显示另一个日期范围内的日期范围

[英]Excel - highlight date range within another date range

Working on a booking system on Excel, I have two components to make it works: 在Excel上的预订系统上工作,我有两个要使它起作用的组件:

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), Tab1-预订系统本身显示从哪个日期范围进行预订的任何元素(例如,从2014年10月21日至2014年10月28日预订的元素A),

Tab2 - A calendar highlighting availability for each booking Tab2-突出显示每个预订可用性的日历

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. 如果两个元素重叠,我想添加的是预订系统(表2)中的一种错误消息(或颜色条件格式)。 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. 元素A从2014年10月21日预订至2014年10月28日,元素B从2014年10月26日预订至2014年10月30日。

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 链接到文件: https : //www.dropbox.com/s/ehwckfr9d3iknca/Booking%20system.xls?dl=0

Any help would be greatly appreciated! 任何帮助将不胜感激!

Thanks, Geralt 谢谢,Geralt

Try this: 尝试这个:

Select Booking sheet > select C or D column cell to apply formatting > Conditional Formatting > New Rule . 选择预订表>选择C或D列单元格以应用格式> Conditional Formatting > New Rule

Add two Rules for two columns. 为两列添加两个规则。 Use a formula to determine which cells to format should be selected. Use a formula to determine which cells to formatUse a formula to determine which cells to format

Formula for two columns are : 两列的公式是:

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

Special attention : 特别注意

a. 一种。 C4 and D3 as starting of formatting b. C4和D3作为格式化开始b。 Ranges onto which these are applied. 这些应用的范围。

See the image below to get the idea: 请参阅下面的图片以了解主意:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM