Sunday, November 29, 2026

Excel Christmas Gift Exchange with INDEX and MOD

A Christmas gift exchange needs two constraints at the same time: nobody can receive the same person as last year, and nobody can receive themselves. A direct random shuffle can satisfy one rule while breaking the other, especially when only a few names remain. A rotating list gives a simpler and more reliable solution for small-business teams and family groups.

The problem

The workbook has three columns:

  • Name list: the person giving a present this year.
  • Previous name: the person that giver selected last year.
  • Name to use: the new recipient.

For each row, the new recipient must differ from both the giver and the previous recipient. For example, Albert cannot receive Albert’s present, and Albert also cannot receive the person he had last year.

This came up in the Stack Overflow community, where the suggested solution was to use a list rotation instead of repeatedly trying random swaps. The original problem and answer are available in the Stack Overflow discussion about avoiding the same position and previous assignment.

The key technical point is that this is a constrained shuffle. In mathematics, a rearrangement where no item stays in its original position is called a derangement. Adding the previous assignment creates another restriction. Some combinations have no valid answer at all, so a formula that chooses names one row at a time can eventually get stuck.

The solution

Use the previous assignments as the starting list, then shift that list by one position. This creates a new assignment without repeating the previous one, provided the original exchange was valid.

Suppose the previous assignments are in B2:B6. Put this formula in C2:

=INDEX($B$2:$B$6,MOD(ROW()-ROW($C$2)+1,ROWS($B$2:$B$6))+1)

The formula shifts every previous name down by one position:

  • The first row receives the second name from the previous list.
  • The second row receives the third name.
  • The final row receives the first name.

INDEX returns a name from the range. ROW() identifies the current worksheet row. MOD wraps the position back to the beginning when the formula reaches the end. ROWS counts the number of names in the list.

For five people, the result looks like this:

Name list Previous name Name to use
Albert Bob Elmer
Bob Elmer Chad
Chad David Albert
David Chad Bob
Elmer Albert David

The exact result depends on the order of the previous-name column. The important property is that each row receives a different entry from that column, and the shifted arrangement can be checked against the name list.

A more robust annual process is to maintain a single assignment list:

  1. Create a valid first-year list by shuffling the names.
  2. Shift that list by one position for the next year.
  3. Shift the new list again the following year.
  4. Continue rotating the list once per year.

This method avoids the need for a VBA Exclude function. It also avoids the risk of choosing a valid-looking name early in the process and leaving no valid choice for the final rows.

The alternative is a formula using LET, LAMBDA, REDUCE, FILTER, XMATCH, VSTACK, and TAKE. That approach can select the first available name while excluding the giver, the previous name, and names already assigned. It is more flexible, but a random version can return blank results when the remaining constraints cannot be satisfied. Use it only when the assignment rules require more than a simple rotation.

How to apply it

  1. Put each giver’s name in column A, starting in A2.
  2. Put last year’s recipient for each giver in column B, starting in B2.
  3. Confirm that every name appears once in column A and once in column B.
  4. Add the formula below to C2:
=INDEX($B$2:$B$6,MOD(ROW()-ROW($C$2)+1,ROWS($B$2:$B$6))+1)
  1. Replace $B$2:$B$6 with the complete previous-name range.
  2. Copy the formula down to the final participant.
  3. Check that column C contains no duplicate names.
  4. Check that each value in column C differs from both columns A and B on the same row.
  5. For the next year, copy column C and paste it as values into column B.
  6. Apply the same formula again to create the next year’s assignment.

The formula above is deterministic, not random. That is useful when reliability matters more than unpredictability. If the gift exchange needs a random first-year arrangement, shuffle the initial list once, then use the rotation method in later years.

For larger groups, do not assume that a valid result always exists. Two participants can create an impossible case if each person is blocked from receiving the only remaining name. This is the edge case that makes a simple random algorithm unreliable. A VBA procedure can search for swaps, but the logic becomes more complicated near the penultimate element, the second-to-last item, and the last item. It may need a quadratic algorithm, meaning it repeatedly searches earlier assignments, rather than a linear algorithm that processes each row once.

Keep the source list clean. Names should match exactly, with no extra spaces or spelling differences. If the workbook contains duplicate names, use a unique employee or family identifier in the calculation and display the person’s name separately.

Implementation angle

This pattern can become a reusable annual assignment workbook with protected input columns, automatic validation, and an exception report for impossible combinations. An automation partner could move the participant list into Zoho Creator, generate the rotated assignments, and send each recipient a private email or message through Make or n8n. Claude can also help build and check the formula, but the final workbook should validate duplicates, self-assignments, and repeated previous names before anyone receives a result.

Book an AI implementation engagement with Creator Scripts at creatorscripts.com to turn this assignment process into a reliable workflow.

Frequently asked questions

How do I assign gift exchange names in Excel without repeating last year?

Put last year’s recipients in a column and use the INDEX and MOD formula to rotate that list by one position. Copy the formula down, then check that no one is assigned to themselves or their previous recipient.

What Excel formula shifts a list of names by one row?

Use =INDEX($B$2:$B$6,MOD(ROW()-ROW($C$2)+1,ROWS($B$2:$B$6))+1) in C2, changing the ranges to match your workbook. Copy it down to rotate the names, wrapping the last entry back to the first.

Can every gift exchange group avoid self-assignments and repeat recipients?

No, some combinations of participants and restrictions have no valid assignment. Check that the final list has no duplicate recipients and that each recipient differs from both the giver and last year’s recipient.

Saturday, November 28, 2026

xlrd Formula Cache and Excel IF Function Results

A formula cell can display text in Excel but arrive in Python as a number when xlrd reads an incomplete or stale formula cache. This affects operators who use old .xls workbooks with scripts that decide whether to process a cell based on its value or ctype.

The problem

The workbook test.xls contains IF formulas that return either text or a calculation. For example, one formula returns "YES" when B1 is greater than zero. Another returns "hello" when a referenced cell is empty. In Microsoft Excel, these cells appear to contain text.

The same cells can produce different results through xlrd:

cell = feuille_1.cell(rowx=i, colx=0)
print(cell)
print(cell.ctype)

A text result may appear as text:'hello' with ctype equal to 1. Another formula that also returns text may appear as number:0.0 with ctype equal to 2.

This issue came up in the Stack Overflow community in the question “Confusion between text and number while reading Excel using xlrd”.

The key detail is that xlrd does not calculate formulas. It reads the result saved inside the .xls file. That saved result is called the cached result. If the file-writing program did not save the text result correctly, xlrd can expose an uninitialized numeric cache, usually 0.0, instead of the text shown by Excel.

The formula itself is stored in the older BIFF8 format as compiled bytecode. The semicolon in a French or European Excel formula is not the cause. Excel uses the local argument separator when editing the formula, while the .xls file stores the compiled representation.

The solution

Do not treat the displayed value in Excel as proof of what xlrd will read. First, check whether the workbook contains a reliable formula cache.

The safest fix is to open and save the workbook with Microsoft Excel, then run the Python script again. Excel normally writes the required cached result for formula cells. If the workbook was created or exported by LibreOffice, an export script, or another third-party tool, that program may have omitted the BIFF8 STRING record used for a formula whose result is text.

You can also make the Python logic more defensive. A ctype value of 2 means that xlrd has classified the cell as a number. A value of 1 means text. However, a numeric 0.0 can be a missing or invalid cached formula result rather than the true result the user sees in Excel.

For a quick inspection:

import xlrd

document = xlrd.open_workbook("test.xls")
sheet = document.sheet_by_index(0)

for row in range(4):
    cell = sheet.cell(rowx=row, colx=0)
    print("value:", repr(cell.value))
    print("ctype:", cell.ctype)
    print("formula:", sheet.cell_formula(row, 0))

The last line is useful only if the workbook and xlrd version support formula inspection. The important point remains that reading the formula does not make xlrd calculate it.

If the script must distinguish text from numbers, avoid relying only on the formula result. Use a workbook process that guarantees recalculation and saving before the file reaches Python. Then validate suspicious values such as 0.0, especially when the corresponding Excel cell visibly contains a word.

How to apply it

  1. Open test.xls in Microsoft Excel.
  2. Check the formula cells and confirm that Excel displays the expected text or number.
  3. Save the workbook again as an .xls file if the existing Python process requires the old format.
  4. Close Excel completely so the file is no longer being edited.
  5. Run the Python script again with xlrd.open_workbook("test.xls").
  6. Print cell.value and cell.ctype for the affected cells.
  7. Compare the results with the visible values in Excel.
  8. If the problem remains, identify which program originally created or exported the file. Test a workbook saved by Microsoft Excel rather than by LibreOffice or an export script.
  9. Add a validation rule before using the value in another calculation:
    cell = sheet.cell(rowx=row, colx=0)
    
    

    if cell.ctype == xlrd.XL_CELL_TEXT:
    ignore_cell = True
    elif cell.ctype == xlrd.XL_CELL_NUMBER:
    if cell.value == 0.0:
    print("Check formula cache before processing")
    else:
    use_value = cell.value

    XL_CELL_TEXT identifies a text cell, while XL_CELL_NUMBER identifies a numeric cell. This check improves safety, but it cannot recover text that was never stored in the file.

  10. If the workbook can be redesigned, store the decision separately from the calculated output. For example, use one column for a status such as READY or SKIP, and another for the numeric result. This is more reliable than asking one formula cell to return either a word or a number.

The formula structure can also be adjusted when appropriate. A formula such as =IF(B1>0,"YES","NO") deliberately returns text in both branches. A formula such as =IF(A5="","hello",A5/B5) returns text in one branch and a number in the other. That mixed output is valid in Excel, but it creates extra work for file-reading scripts. Separate status and value columns make the data type predictable.

Implementation angle

A reliable automation flow can open each incoming workbook, verify formula caches, flag suspicious numeric zeros, and send exceptions for review before importing inventory, quotes, or reports. For a more durable process, an automation partner can move the status and numeric fields into Zoho Creator, then synchronize approved data through Make or n8n instead of depending on mixed-type Excel formulas. Book an AI implementation engagement with Creator Scripts at creatorscripts.com.

Frequently asked questions

Why does xlrd read my Excel formula as 0 instead of text?

xlrd reads the formula result saved in the .xls file and does not calculate the formula itself. If the saved result is missing or stale, xlrd may return 0.0 even when Excel displays text.

How do I make xlrd read the correct formula result?

Open the workbook in Microsoft Excel, let it recalculate, and save it again before running your script. Then check the cell’s value and ctype in Python to confirm what was saved.

Can xlrd calculate formulas in an .xls workbook?

No, xlrd reads stored formula results rather than calculating formulas. If the result is incorrect or missing, use a program that recalculates and saves the workbook before xlrd reads it.

Friday, November 27, 2026

Mixed Excel Dates with Axyra’s dateValue() Method

Mixed Excel date columns often contain true date values, text strings, and empty cells. In Axyra Sheets, cell.dateValue() handles only numeric cell values, so text dates return null and can trigger a NullPointerException during validation.

The problem

This issue affects operators cleaning older Excel workbooks before sorting, filtering, or loading data into another system. A date column may contain proper Excel date values alongside text such as 2026/01/01, 2026-01-01, or 2026 01 01.

The problem came up in the Stack Overflow community while iterating through sheet.usedRange() in Axyra Sheets. The workbook contained mixed cell types, and calling cell.dateValue() for every date column did not produce a LocalDate for text cells.

Excel stores many real dates as numbers with a date format. Axyra exposes those values as CellValue.Number, and cell.dateValue() can convert them to LocalDate. A text date is different. Axyra exposes it as CellValue.Text, so cell.dateValue() returns null.

Blank cells also need explicit handling. An empty date may mean that the date is unknown, not that the workbook is broken. Treating every null as a valid date causes errors later when fixDate expects a non-null LocalDate.

The solution

Read the cell's CellValue first, then choose the conversion method based on its type:

  • CellValue.Number: call cell.dateValue().
  • CellValue.Text: trim the text and pass it to a date parser.
  • CellValue.Blank: return null and let the validation process decide whether an unknown date is acceptable.
  • Any other value: raise an IllegalStateException, because the cell contains an unexpected type.

The key is to separate date reading from date validation. The readDate method should determine what date, if any, the cell represents. The fixDate method should then check date limits, correct known problems, or preserve a valid date.

A practical implementation looks like this:

LocalDate readDate(Cell cell) {
    CellValue value = cell.value();

    if (value instanceof CellValue.Number) {
        return cell.dateValue();
    }

    if (value instanceof CellValue.Text textValue) {
        return parseDateText(textValue.value().trim());
    }

    if (value instanceof CellValue.Blank) {
        return null;
    }

    throw new IllegalStateException("Not a supported date cell: " + value);
}

CellValue.Number covers Excel's normal numeric date handling. CellValue.Text requires text-to-date conversion. CellValue.Blank provides predictable null handling for empty cells. The exception protects the process from silently accepting an unsupported value.

The text parser should accept only the formats your business actually uses. For example, it may convert 2026/01/01, 2026-01-01, and 2026 01 01 into the same LocalDate. It should reject ambiguous or malformed values rather than guessing.

How to apply it

  1. Identify the date columns before iterating through the worksheet. This is safer than trying to detect dates in every cell.

  2. Obtain the cells from the used range and iterate through the expected rows.

    for (int row = firstRow; row <= lastRow; row++) {
        Cell cell = sheet.cell(row, dateColumn);
        LocalDate date = readDate(cell);
    
        LocalDate normalized = fixDate(date);
    
        if (normalized != null) {
            cell.setDate(normalized);
        }
    }
    
  3. Inspect the cell value before converting it. cell.value() tells you whether the cell is numeric, text, blank, or another type.

  4. Convert numeric values with cell.dateValue(). This preserves Axyra's Excel date handling for cells that already contain usable date values.

  5. Convert text values with parseDateText. Trim spaces first, then parse the supported separators and date patterns.

  6. Return null for CellValue.Blank. Update fixDate so it handles an unknown date before applying validation rules.

    LocalDate fixDate(LocalDate date) {
        if (date == null) {
            return null;
        }
    
        if (date.isBefore(minAllowedDate)) {
            return minAllowedDate;
        }
    
        if (date.isAfter(maxAllowedDate)) {
            return maxAllowedDate;
        }
    
        return date;
    }
    
  7. Write only valid normalized dates back to the workbook with cell.setDate(). Do not write a null value unless Axyra's workbook rules specifically require it.

  8. Record rejected text values and unexpected cell types. A row number, column name, original value, and reason make spreadsheet data cleaning easier to audit.

  9. Test the process with at least four cases: a numeric Excel date, a recognized text date, a blank cell, and an invalid text value.

  10. After normalization, sort and filter the table again. Consistent date values prevent text dates from being sorted alphabetically ahead of real Excel dates.

One alternative is to convert every date column to text first and parse all values through one route. That can work, but checking CellValue is more robust because it preserves valid numeric dates and distinguishes blanks from malformed text.

Implementation angle

This pattern is a good boundary for an automation workflow. Axyra can normalize date columns before the workbook is synchronized with Zoho Creator, Make, or n8n, while rejected values can be sent to an exception list for review. A language model such as Claude can help generate and test date parsing rules, but the allowed formats and date boundaries should remain explicit in code.

Book an AI implementation engagement with Creator Scripts at creatorscripts.com.

Frequently asked questions

Why does cell.dateValue() return null for some Excel dates?

Excel dates may be stored as numbers or as text. In Axyra Sheets, cell.dateValue() converts numeric date values, but text dates need to be parsed separately.

How do I handle blank cells in an Excel date column?

Check whether the cell is blank before validating its date. Return null for an empty cell, then make sure your validation method handles that value without calling date methods on it.

How can I convert text dates in Excel with Java?

Check the cell value type first, then trim and parse text using the date formats your business accepts. Reject malformed or ambiguous dates instead of guessing, and keep a record of values that could not be parsed.

Wednesday, November 25, 2026

Copilot in Excel: November 2026 Updates

Copilot in Excel: November 2026 Updates

November’s Excel update focuses on reducing repetitive work in finance, analysis, and formula troubleshooting. The most relevant changes affect teams using Copilot in Excel for account reconciliations, journal entries, PivotTables, shared reports, and month-end reporting. Availability varies by platform and rollout channel, so some features may not appear in every Microsoft 365 account yet.

What changed

Microsoft lists new accounting skills in Copilot in Excel, Copilot access for read-only workbooks, more model choices, PivotTable grouping, descriptive formula error cards, and background tasks on iPhone. The full announcement is available in Microsoft’s November 2026 Excel update.

The four changes with the clearest value for small and mid-size businesses are:

  • Accounting skills in Copilot in Excel: Available through Microsoft’s Frontier program for Excel on Windows, Mac, and the web. Copilot can compare balances and transactions, prepare reconciliation items, draft accruals, reclassifications, allocations, reversals, and recurring journal entries, and check whether entries balance. It can also compare performance with a plan and prepare reporting that explains the main changes.
  • PivotTable grouping with Copilot: Rolling out to Insiders on Excel for Windows, Mac, and the web. You can ask Copilot to group dates, numeric ranges, or custom groups without changing the source data. For example, daily sales can be grouped into monthly totals.
  • Copilot in read-only workbooks: Rolling out on Excel for Windows, Mac, and the web. When someone shares a report that you can only view, you can still ask Copilot about the data and the figures that stand out.
  • Descriptive formula error cards: Rolling out on Excel for Windows, version 2611, build 16.0.20625.20000 or later. Hovering over supported errors such as #REF! or #VALUE! now shows the meaning, possible causes, and suggested fixes. The card can also show calculation steps. For supported errors, Fix this error can ask Copilot to diagnose and repair the formula.
  • Background tasks in Excel for iPhone: Rolling out for Excel on iPhone. You can start a Copilot task, leave the app, and return after Excel notifies you that the work is complete.

Microsoft also added more choices to the Copilot model picker. GPT-6.2 Sol is available in Copilot in Excel, while GPT-6.2 Astra, GPT-6 Astra, Claude Fable 5.2, and Claude Fable 5.1 are available through the Frontier program with usage-based billing when an administrator enables billing and assigns credits.

Why it matters for your business

For a business that closes its books in Excel, accounting skills could reduce the manual preparation required at month-end. Copilot can compare a bank export with a ledger, identify items that need review, and prepare a proposed reconciliation. It can also draft entries for expenses incurred but not yet invoiced, corrections between accounts, cost allocations, and recurring adjustments.

The control point remains human review. A draft entry is not an accounting approval. Check the source transactions, account codes, tax treatment, dates, supporting documents, and debit and credit totals before posting anything to your accounting system.

PivotTable grouping is useful when sales, inventory, or service data arrives at a daily level but management reports need weekly or monthly views. Asking Copilot to create the grouping can save time and reduce repetitive menu work. Because the source data remains unchanged, the grouping is easier to test against the original records.

Read-only access is helpful for owners, managers, and external advisors. A shared workbook can answer questions without giving every person permission to edit formulas or overwrite figures. This supports safer reporting workflows, especially when the workbook is a final management report.

Descriptive error cards help operators solve formula problems without searching for every error code. #REF! usually indicates that a formula points to a deleted or invalid reference. #VALUE! generally indicates that a formula received an incompatible type of value. The error card adds context and may help identify the broken step faster.

How to use it

  1. Create a clean working copy. Save the month-end workbook with a clear period name, such as Close_2026_11. Keep the original source files unchanged.
  2. Separate source data from reports. Store transactions in structured tables with consistent column names for date, document number, account, customer, supplier, amount, and status.
  3. Open Copilot in Excel. Use a direct request such as: “Compare the transactions in the bank table with the ledger table and prepare a list of unmatched items for review.”
  4. Review the reconciliation. Check unmatched transactions against bank statements, invoices, receipts, and payment records. Do not treat a suggested match as confirmed until the supporting record agrees.
  5. Request a journal-entry draft. Ask Copilot to draft an accrual, reclassification, allocation, reversal, or recurring entry. State the accounting period, accounts, amount, business reason, and source data.
  6. Check the entry manually. Confirm the required inputs, debits, credits, dates, descriptions, and supporting evidence. The entry must balance before anyone posts it.
  7. Use PivotTable grouping for reporting. Select the PivotTable and ask Copilot to group dates by month or amounts into useful ranges. Compare the grouped totals with the ungrouped data.
  8. Use Copilot on read-only reports. Open the shared workbook and ask which figures changed most, which categories are largest, or what values appear unusual. Treat the answers as analysis support, not as a replacement for checking totals.
  9. Investigate formula errors. Hover over the error indicator. Read the explanation, select Show Calculation Steps when available, and use Fix this error only after confirming that the proposed repair matches the intended business logic.
  10. Test before publishing. Recalculate the workbook, compare key totals with the source system, and keep a review log for changes made by Copilot or by the finance team.

For a small operation, start with one repeatable process, such as bank reconciliation or monthly sales reporting. Measure the time saved and the number of corrections required before expanding the workflow.

Implementation angle

Creator Scripts can turn a monthly reconciliation workbook into a controlled process that imports bank and accounting exports, sends exceptions to a review queue, and records approval before a journal-entry file is created. A Make or n8n workflow can move source files into the right folder, while Zoho Creator can store reconciliation status, responsible staff, evidence, and deadlines outside the workbook. Claude can help document formulas, check proposed repairs, and compare the workbook’s logic with the business rules before automation is released.

Book an AI implementation engagement with Creator Scripts at creatorscripts.com.

Frequently asked questions

Can Copilot in Excel help with bank reconciliations?

Copilot can compare bank transactions with ledger entries and prepare a list of items that may need review. Check each suggested match against bank statements and supporting records before confirming it.

Can Copilot create journal entries in Excel?

Copilot can draft entries such as accruals, reclassifications, allocations, and recurring adjustments. Review the accounts, dates, amounts, supporting documents, and debit and credit totals before posting an entry.

Can Copilot group dates in an Excel PivotTable by month?

Copilot can group PivotTable dates by month without changing the source data. Compare the grouped totals with the original records to check the report.

Monday, November 9, 2026

Excel Conditional Formatting with VLOOKUP and DAY

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

  1. Store each task on one row. Use columns for item, due date, checkbox, date completed, and days left.

  2. Enter real due dates in column B. Do not type dates as labels such as 15/03/26 if Excel is treating them as text.

  3. Put a checkbox in column C. Confirm that an unchecked box evaluates to FALSE and a checked box evaluates to TRUE.

  4. In column D, use =IF(C1=TRUE,IF(D1="",NOW(),D1),""). Format the cells as date and time.

  5. In column E, use =IF(C1=TRUE,"",B1-TODAY()). Format the result as a number.

  6. Select the complete range that should change color, starting with the first data row.

  7. Create a completed rule with =$C1=TRUE. Use a muted green or gray format.

  8. Create an urgent rule with =AND($C1=FALSE,$B1<>"",$B1-TODAY()<=3). Use red or orange.

  9. Create a time-remaining rule with =AND($C1=FALSE,$B1<>"",$B1-TODAY()>30). Use green.

  10. Test one task with a due date in the past, one due soon, one due later, and one completed task.

  11. Avoid DAY() unless the requirement is specifically to inspect the day number within a month. Use the complete date for deadline comparisons.

  12. Use VLOOKUP or XLOOKUP only 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.