How to find the closest date to today on a list in Excel?
Managing dates in Excel is a frequent requirement, whether you’re keeping tabs on project deadlines, organizing schedules, or conducting time-based data analysis. A common challenge, however, is identifying which date in a list is closest—either in the past or the future—to the current date. Finding this “nearest date” helps prioritize tasks, spot upcoming or overdue events, and make prompt decisions. Excel provides multiple practical approaches to achieve this, through formulas, built-in tools, conditional formatting, VBA code, and the use of Kutools AI. In this tutorial, we’ll walk you through several effective methods, analyze when each may be most useful, and provide tips and troubleshooting suggestions along the way.
Find and highlight the closest past or future date to today with formulas
Find and highlight the closest past or future date to today with Kutools AI
Find and highlight the closest past or future date to today with Conditional Formatting
Find and highlight the closest past or future date to today using VBA code
Find and highlight the closest past or future date to today with formulas
● Find the closest past date to today
Imagine a scenario where you have a list of dates, and today’s date is 1/29/2015. You need to quickly identify the most recent date before today’s date. This is particularly useful for checking the last completed task or tracking deadlines that have just passed. Here’s how to do it using an array formula:
1. Select a blank cell, for example cell B2, where you want to display the nearest past date.
2. Enter the following formula in the Formula Bar and then press Ctrl + Shift + Enter (since this is an array formula):
=MAX(($A$2:$A$18<TODAY())*A2:A18)
After pressing Ctrl+Shift+Enter, the cell (B2) will display the closest past date to today (for instance, 1/26/2015 as shown above). If you have more dates or a different range, make sure to adjust $A$2:$A$18
to match your actual data set.
- Applicable scenarios: This method is best when you need a static value in a single cell and want to refer to it elsewhere in your calculations or reports.
- Advantages: Simple, uses built-in Excel functionality, does not require any add-ins or complex setup.
- Limitations: Only returns a value, does not visually highlight the result. For very large data, array formulas can impact performance.
● Find the closest future date to today
This section explains how to locate the earliest date that is still upcoming—great for spotting the next appointment, event, or deadline:
1. Click in a blank target cell (such as B2), then enter the following formula and press Ctrl + Shift + Enter to confirm it as an array formula:
=MIN(IF(A2:A18>TODAY(),A2:A18))
This formula will output the closest future date after today into cell B2.
- Tips:
- Ensure all date values in your source range (A2:A18) are valid Excel date values, otherwise the formula may return errors or unexpected results.
- If you copy the formula to other cells, update references accordingly to avoid referencing wrong ranges.
- If your cell is not formatted as a date, use Ctrl+1 to open Format Cells and adjust it to a Date format so the result displays correctly.
- If there is no future date in your range, the formula will return 0.
Notes:
- Adjust the range in the formula to match your dataset.
- Whenever you update your date list, the formula will automatically recalculate when you recalculate the workbook.
Find and highlight the closest past or future date to today with Kutools AI
Simplify date analysis by using the Kutools AI Aide feature in Excel. This approach allows for immediate detection and highlighting of the closest past or future date, which can be especially helpful for users who want a quick, interactive solution without building complex formulas or code.
After installing Kutools For Excel, you can access the Kutools AI Aide pane through Kutools > AI Aide.
- Select the range of date data you wish to analyze.
- Type your request into the Kutools AI chat box, for example:
Find the closest past date to today from the selected dates and highlight with a light red color
Find the closest future date to today from the selected dates and highlight with a light red color - Press Enter or click the Send button. Once the analysis is complete, click Execute to apply the results and see the closest date highlighted in your worksheet.
- Applicable scenarios: Ideal for users who prefer visual feedback and want a guided, AI-powered way to manage and visualize date proximity in their data.
- Advantages: Fast, easy, and interactive. Supports highlighting and works well for both basic and more nuanced requirements.
- Limitations: Requires installation of Kutools. Best for users who frequently use Excel for various advanced data tasks.
Efficiently finding the closest date to today can improve productivity when handling schedules, deadlines, or event planning. By integrating these methods into your workflow, you streamline your activities and reduce manual lookup errors. For additional Excel resources and tips, explore our comprehensive tutorial library.
Find and highlight the closest past or future date to today with Conditional Formatting
If you want to automatically highlight the date in your list that is closest to today—whether it’s in the past or future—without using helper columns, you can use Conditional Formatting with a formula. This method is practical for schedule reviews, meeting reminders, or deadline checks, and provides immediate visual cues in your sheet.
- Applicable scenarios: Best when you want the nearest date to stand out visually every time your data or today’s date changes.
- Advantages: Automatic visual identification, no manual lookup each day. Works dynamically as time passes or data updates.
- Limitations: Highlights only the first instance found if there are duplicates. May need adjustment in complex scenarios.
To highlight the date in A2:A18 that is closest (whether before or after) to today, follow these steps:
- Select your range of dates (for example, A2:A18).
- On the Home tab, click Conditional Formatting, then choose New Rule.
- Select Use a formula to determine which cells to format.
- Paste the following formula in the formula box:
=AND(A2<>TODAY(), ABS(A2-TODAY())=MIN(IF($A$2:$A$18<>TODAY(), ABS($A$2:$A$18-TODAY()))) )
- Click Format, choose your desired highlight formatting (e.g., fill color), and click OK to finish setting the rule.
This formula highlights the date that is closest to today, excluding today itself. If the nearest date is in the past, it highlights that past date. If the nearest date is in the future, it highlights that future date.
In other words, it always highlights the single date (other than today) with the smallest absolute difference from today, regardless of whether that date is before or after today.
- Tips: This method compares both past and future dates. If you want to highlight only the closest upcoming or most recent past date, you will need a slightly different formula or an additional helper column.
- Precautions: Conditional formatting with array formulas works well from Excel 2013 onward. Earlier versions may require entering the formula differently or adapting the method.
- Adjustment: If you have blank cells or non-date entries, make sure your range contains only valid dates to avoid formatting errors.
Find and highlight the closest past or future date to today using VBA code
For users comfortable with macros, using VBA offers a programmable way to not only find but also highlight the date closest to today, giving more flexibility for complex logic—such as excluding weekends, ignoring blanks, or adding interactive prompts. This approach is suitable for automating recurring tasks in larger workbooks or for users managing large datasets.
- Applicable scenarios: Useful when you want complete control, need to process a large list, or automate the highlight/selection process repeatedly.
- Advantages: Fully customizable, can extend to match business logic, automate selection, or add user prompts for specific behaviors.
- Limitations: Requires macro-enabled workbook and basic VBA knowledge. Can be disabled by Excel security settings.
Below is a sample VBA macro to find the closest date to today (either in the past or future) in your selected list and optionally highlight it:
1. Go to the Developer tab, click Visual Basic to open the VBA editor. In the VBA window, select Insert > Module, and paste the code below into the module:
Sub HighlightClosestDateExcludingToday()
'Updated by Extendoffice 20250722
Dim WorkRng As Range
Dim ClosestCell As Range
Dim MinDiff As Double
Dim CurrentDiff As Double
Dim TodayDate As Date
Dim cell As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Select the range containing the dates:", xTitleId, WorkRng.Address, Type:=8)
If WorkRng Is Nothing Then Exit Sub
TodayDate = Date
MinDiff = 1E+100
For Each cell In WorkRng
If IsDate(cell.Value) And Not IsEmpty(cell.Value) Then
If cell.Value <> TodayDate Then ' ????
CurrentDiff = Abs(cell.Value - TodayDate)
If CurrentDiff < MinDiff Then
MinDiff = CurrentDiff
Set ClosestCell = cell
End If
End If
End If
Next cell
If Not ClosestCell Is Nothing Then
ClosestCell.Interior.Color = vbYellow ' ??????
MsgBox "The date closest to today (excluding today) is: " & ClosestCell.Value, vbInformation, "Closest Date"
Else
MsgBox "No valid dates (other than today) found in the selected range.", vbExclamation, "No Date"
End If
End Sub
2. Press to run the code. A dialog will ask you to select your range of dates. After confirming, the closest date to today will be highlighted in yellow and a message box will show its value.
- Tips: You can modify the highlight color by changing
vbYellow
to another color constant or RGB value. - Precautions: Your date range should not contain text or blank cells, or else the VBA code may skip those entries. Always backup your data before running macros.
- Troubleshooting: If security settings prevent macros from running, go to File > Options > Trust Center > Trust Center Settings > Macro Settings to enable.
When deciding which method to use to find the closest date to today in Excel, consider your specific needs: for quick, formula-based outputs, use the built-in functions; for dynamic, visual feedback, try Conditional Formatting; for automation or batch processing, leverage VBA code; and for guided, all-in-one solutions, Kutools AI offers a user-friendly option. Remember to check your cell formats and ranges, handle possible empty or invalid cells, and save your workbook before running macros. By applying these techniques, you'll streamline your scheduling and data review processes, and minimize manual searching or errors.
Related articles:
- How to find first or last Friday of every month in Excel?
- How to find lowest and highest5 values in a list in Excel?
- How to find or check if a specific workbook is opened or not in Excel?
- How to find out if a cell is referenced in other cell in Excel?
- How to find position of first/last number in a text string in Excel?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
All Kutools add-ins. One installer
Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.





- All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
- One installer, one license — set up in minutes (MSI-ready)
- Works better together — streamlined productivity across Office apps
- 30-day full-featured trial — no registration, no credit card
- Best value — save vs buying individual add-in