Skip to content
xlsoffice. All Rights Reserved
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Lookup and Reference Examples

  • How to retrieve first match between two ranges in Excel
  • Multi-criteria lookup and transpose in Excel
  • Find Closest Match in Excel Using INDEX, MATCH, ABS and MIN functions
  • Create hyperlink with VLOOKUP in Excel
  • How to create dynamic named range with OFFSET in Excel

Data Analysis Examples

  • Get column name from index in Excel Table
  • How to sum a total in multiple Excel tables
  • How to Sort by Color in Excel
  • How To Insert and Customize Sparklines in Excel
  • How to perform a t-Test in Excel

Data Validation Examples

  • Excel Data validation must not contain
  • Excel Data validation don’t exceed total
  • Excel Data validation whole percentage only
  • How To Create Drop-down List in Excel
  • Excel Data validation number multiple 100

Highlight dates in the next N days in Excel

by

This tutorial shows how to Highlight dates in the next N days in Excel  using the example below;

Formula

=AND(A1>TODAY(),A1<=(TODAY()+days))

Explanation

If you want to highlight dates that occur in the next N days with conditional formatting, you can do so with a formula that uses the TODAY function with AND. This is a great way to visually flag things like expiration dates, deadlines, upcoming events, and dates relative to the current date.

For example, if you have dates in the range B4:G11, and want to highlight cells that occur in the next 30 days, select the range and create a new CF rule that uses this formula:

=AND(B4>TODAY(),B4<=(TODAY()+30))

Note: it’s important that CF formulas be entered relative to the “active cell” in the selection, which is assumed to be B4 in this case.

Worked Example:   Identify Duplicate Values vs Remove Duplicates in Excel

Once you save the rule, you’ll see the dates occurring in the next 30 days highlighted.

How this formula works

The AND function takes multiple arguments and returns TRUE only when all arguments return TRUE. The TODAY function returns the current date. Dates in Excel are simply large serial numbers, so you can create a new relative date by adding or subtracting days. TODAY() + 30 creates a new date 30 days in the future, so when a days is greater than today and less than today + 30, both conditions are true, and the AND function returns true, triggering the rule.

Worked Example:   Check if multiple cells have same value with case sensitive in Excel

Variable days

Of course, you can adjust days to any value you like:

=AND(B4>TODAY(),B4<=(TODAY()+7)) // next 7 days
=AND(B4>TODAY(),B4<=(TODAY()+45)) // next 45 days

Use other cells for input

You don’t need to hard-code the dates into the rule. To make a more flexible rule, you can use other cells like variables in the formula. For example, you can name cell E2 “days” and rewrite the formula like so:

=AND(B4>TODAY(),B4<=(TODAY()+days))

When you change either date, the conditional formatting rule will respond instantly. By using other cells for input, and naming them as named ranges, you make the conditional formatting interactive and the formula is simpler and easier to read.

Worked Example:   Conditional Formatting Rules in Excel

Post navigation

Previous Post:

Highlight dates that are weekends in Excel

Next Post:

Highlight dates in same month and year in Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others
  • How to strip non-numeric characters in Excel
  • Extract most frequently occurring text in Excel
  • Remove text by matching in a cell in Excel
  • How to get page from URL in Excel
  • How to remove trailing slash from url in Excel
  • How to get Weekdays, Working days between Two Dates in Excel
  • TIME function: Description, Usage, Syntax, Examples and Explanation
  • List holidays between two dates in Excel
  • How to calculate nth day of week in month in Excel
  • Count times in a specific range in Excel
  • PMT, RATE, NPER, PV and FV Financial Functions in Excel
  • DDB function: Description, Usage, Syntax, Examples and Explanation
  • YIELDMAT function: Description, Usage, Syntax, Examples and Explanation
  • COUPDAYSNC function: Description, Usage, Syntax, Examples and Explanation
  • How to calculate Net Present Value (NPV) in Excel
© 2022 xlsoffice . All Right Reserved. | Teal Smiles