简体   繁体   中英

If Data in Column appears within Date Range then highlight

I would like to do some conditional formatting on a Project Planner that will highlight a persons name if the dates selected for an activity to which they are assigned fall within a date range for another action to which they are also assigned.

On my spreadsheet I have the following columns:

  • Column A: Activity
  • Column B: Start Date
  • Column C: End Date
  • Column D: Responsible Person

To give an example of how I would like the formula to work:

Person A has been assigned an activity that begins on 01/02/14 and ends on 07/02/14. If a subsequent activity is then added to the sheet that either begins or ends on any of the dates within the range 01/02/14-07/02/14 and the person is assigned to it, i would like to use conditional formatting to highlight the cell as a sign to the user.

Any help would be appreciated.

Thanks,

Ryan

You could maybe use COUNTIFS with the conditional formatting:

=COUNTIFS(D:D,D1,B:B,"<="&C1,C:C,">="&B1)>1

This counts all the instances where the following conditions are satisfied:

  1. The responsible person is the same person ( D:D, D1 part)

  2. The dates the other activities begin are before or equal to the date a certain activity ends. ( B:B,"<="&C1 part)

  3. The dates the other activities end are equal or after to the date a certain activity begins. ( C:C,">="&B1 part)

The formula can make Excel respond quite slowly since it takes into consideration the whole column. Change it to a range if possible, for example, if you always have about 100 activities, you could maybe use:

=COUNTIFS(D1:D120,D1,B1:B120,"<="&C1,C1:C120,">="&B1)>1

Here is what I get after using this conditional formatting:

在此处输入图片说明

COUNTIFS returns a number; a count of cells that satisfies the conditions. Since we have >1 at the end, this means that the cell(s) will get highlighted if there is more than one cell with the same conditions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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