12-16-2020 02:04 AM
12-16-2020 02:04 AM
I need to prepare a table where I will be entering the dates of employee leave.
I need to prepare a sheet in such a way that whenever I enter the From and To date, it should colour the cells accordingly as per the date mentioned above. I have attached a screen shot of the sheet.
12-16-2020 05:18 AMSolution
Select the range that you want to format (E3:NE8).
I will assume that E3 is the active cell in the selection.
On the Home tab of the ribbon, click Conditional Formatting > New Rule...
Select 'Use a formula to determine which cells to format'.
Enter the formula
Activate the Fill tab.
Select a highlight color.
Click OK, then click OK again.
12-17-2020 12:27 AM
Thanks @Hans Vogelaar
That worked like a charm. I am still trying to figure out what does the formula convey. Is there any way you could explain , how does that formula work.
12-17-2020 03:05 AM
12-17-2020 04:54 AM
The formula =AND(E$2>=$C3,E$2<=$D3) is for cell E3 (the active cell in the selection). Excel will automatically adjust it for the other cells in the selection.
E$2 is the cell in the same column in row 2. This is the date you want to look at.
$C3 is the cell in the same row in column C: the Date From.
$D3 is the cell in the same row in column
The formula returns TRUE if the date in E$2 is on or after the Date From, and also on or before the Date To, and FALSE otherwise.
12-17-2020 05:00 AM
Will those cells contain other data?
If so, will at always be a number? Or could it be text?
12-17-2020 05:02 AM
@Hans Vogelaar- The cell is as shown in the picture.
The cells are blank, when I enter the dates To and From - it will display it with the colour and mention a text as "AL"
12-17-2020 05:05 AM
Enter the following formula in E3:
Fill or copy down, then to the right.
12-20-2020 12:06 AM
I tried it out, but it doesnt work.
I inserted the earlier one and the new one as two different formulas and still doesnt work.
12-20-2020 03:17 AM
Could you attach a sample workbook without sensitive information? Thanks in advance.