The problem is not really whether conditional formatting can combine VLOOKUP and DAY(). The reliable solution is to compare real dates and checkbox values directly. This matters for small businesses that use a spreadsheet to track tasks, quotes, inventory reviews, renewals, or customer follow-up.
The problem
A task list may contain the item, due date, checkbox, date completed, and days left. When someone checks the box, the workbook records the date and time completed with a formula such as:
=IF(C1=TRUE,IF(D1="",UPPER(TEXT(NOW(),"mm/d/yy | h:mm AM/PM | dddd")),D1),"")
IF performs a logical test. Here, it checks whether the checkbox is TRUE. NOW() returns the current date and time. TEXT converts that value into displayed text, and UPPER changes the text to uppercase.
This question came up in the r/excel community. The original setup appears to mix date calculations, color coding, checkbox status, and possibly VLOOKUP or DAY() in the same process. The original Excel community question provides the context.
The main risk is converting a date into text too early. Once the completion date becomes text, Excel cannot compare it as cleanly as a true date and time. DAY() returns only the day of the month, such as 6 or 25. It does not represent the complete due date. A date like January 6 and a date like December 6 both return 6, so DAY() is not suitable for deciding whether a task is overdue.
VLOOKUP searches the first column of a range and returns a value from another column in the same row. It can work inside conditional formatting, but it is usually unnecessary when the due date and checkbox already exist on the same task row.
The solution
Keep the completion date as a real date and time, then use conditional formatting formulas that evaluate the checkbox and due date.
First, change the completion formula so that it stores a number rather than formatted text:
=IF(C1=TRUE,IF(D1="",NOW(),D1),"")
The first IF checks the checkbox. The second IF prevents Excel from replacing the original completion timestamp every time the workbook recalculates. Apply a date and time format to column D instead of using TEXT. This preserves the value for sorting, filtering, reporting, and comparisons.
For the days-left column, assuming the due date is in B1 and the task is complete when C1 is TRUE, use:
=IF(C1=TRUE,"",B1-TODAY())
TODAY() returns today’s date without the current time. Subtracting it from the due date returns the number of calendar days remaining. The formula leaves completed tasks blank.
For color coding, select the task range, open Conditional Formatting, choose the option to use a formula, and add separate rules.
For completed tasks, use:
=$C1=TRUE
This rule checks the checkbox in column C. The dollar sign before C locks the column while allowing the row number to change.
For overdue or urgent tasks, use:
=AND($C1=FALSE,$B1<>"",$B1-TODAY()<=3)
AND returns TRUE only when every condition is met. This rule colors unchecked tasks due today or within the next three days. The second condition prevents blank due dates from being treated as urgent.
For tasks with plenty of time, use:
=AND($C1=FALSE,$B1<>"",$B1-TODAY()>30)
For tasks due in more than three days but no more than 30 days, use:
=AND($C1=FALSE,$B1<>"",$B1-TODAY()>3,$B1-TODAY()<=30)
You can apply these rules to the entire row, such as $A$1:$E$100, or only to the days-left column. If rules overlap, place the completed rule first and use the rule manager to control priority.
VLOOKUP is appropriate when the due date or status must be retrieved from another table. For example, if column A contains a task ID and a separate range contains the due date, a conditional formatting rule could use:
=AND($C1=FALSE,VLOOKUP($A1,$H$2:$J$100,3,FALSE)-TODAY()<=3)
The final argument, FALSE, requires an exact match. Without it, VLOOKUP may return an approximate match, which is risky for task deadlines.
If the workbook supports Office 365, XLOOKUP is generally easier to read:
=AND($C1=FALSE,XLOOKUP($A1,$H$2:$H$100,$J$2:$J$100)-TODAY()<=3)
XLOOKUP searches a range and returns the corresponding value from another range. Unlike VLOOKUP, it does not require the lookup column to be the first column of a table.
How to apply it
Store each task on one row. Use columns for item, due date, checkbox, date completed, and days left.
Enter real due dates in column B. Do not type dates as labels such as
15/03/26if Excel is treating them as text.Put a checkbox in column C. Confirm that an unchecked box evaluates to
FALSEand a checked box evaluates toTRUE.In column D, use
=IF(C1=TRUE,IF(D1="",NOW(),D1),""). Format the cells as date and time.In column E, use
=IF(C1=TRUE,"",B1-TODAY()). Format the result as a number.Select the complete range that should change color, starting with the first data row.
Create a completed rule with
=$C1=TRUE. Use a muted green or gray format.Create an urgent rule with
=AND($C1=FALSE,$B1<>"",$B1-TODAY()<=3). Use red or orange.Create a time-remaining rule with
=AND($C1=FALSE,$B1<>"",$B1-TODAY()>30). Use green.Test one task with a due date in the past, one due soon, one due later, and one completed task.
Avoid
DAY()unless the requirement is specifically to inspect the day number within a month. Use the complete date for deadline comparisons.Use
VLOOKUPorXLOOKUPonly when the task data is stored in another range. Otherwise, direct references are simpler and less likely to break.
Implementation angle
This task tracker can become a structured workflow in Zoho Creator, with separate fields for task status, due date, completion timestamp, and owner. Make or n8n can synchronize new tasks from forms, email, or a sales system, then send reminders when the calculated deadline enters the urgent range. Claude can help generate and check the conditional formatting formulas, but the workbook should retain real date values instead of text so the automation remains dependable.
Book an AI implementation engagement with Creator Scripts at creatorscripts.com.
Frequently asked questions
Can conditional formatting use VLOOKUP in Excel?
Yes. A conditional formatting formula can use VLOOKUP to find a value in another table. Use FALSE for an exact match, and check that the lookup returns a real date if you are comparing deadlines.
Why does DAY() give the wrong result for due dates?
DAY() returns only the day number within a month, not the full date. January 6 and December 6 both return 6, so compare the complete due date with TODAY() instead.
How do I highlight overdue tasks that are not checked off?
With the due date in column B and the checkbox in column C, use =AND($C1=FALSE,$B1<>"",$B1<TODAY()) as a conditional formatting rule. This highlights tasks with a due date before today that are still unchecked.