Excel Date Range – A Guide

This is an overview:

Overview image of Excel Date Range


Download Practice Workbook


How to Create a Date Range in Excel

The dataset below contains the start and end dates of different events.

dataset

  • To see the date range for each event in a single cell, use the following formula.
=TEXT(C5,"dd mmm")&" - "&TEXT(D5,"dd mmm")

creating date range using Text function


Date Range in Excel – 6 Examples

Example 1 – Use the IF and the TEXT Functions to Create a Date Range if the Start or End Date Is Missing

  • Use following formula to return  the start date only if the end date is missing. It will return an empty string if the start date is missing.
=IF(C5<>"",TEXT(C5,"dd mmm")&IF(D5<>"","-"&TEXT(D5,"dd mmm"),""),"")

Using IF and TEXT Functions to Create Date Range When Start or End Date Is Missing


Example 2 – Create a Date Range Starting Today and Adding Number

To create a dataset in which the first Project starts today and each project takes 2 months to be completed and starts 2 days after the previous project is completed:

  • Use the following formula:
=TODAY()

Using TODAY function

  • You want the end date of Project A to be 2 months or after the start date: add 60 to C5 to get the value.
=C5+60

Adding number to date

  • To get the start date of Project B, add 2 to D5.
=D5+2

Adding number

  • Drag down the Fill Handle to see the result in the rest of the cells.

After auto filling date range in Excel


Example 3 – Create a Date Sequence in Excel

To create a date sequence with a 3-day interval:

  • Enter the first 2 dates and select them.
  • Drag down the Fill Handle to copy the pattern.

Creating Date Sequence in Excel using Fill Handle tool

  • Click the square box shown below to see other options to fill your dataset.

Created Date Sequence


Example 4 – Count Values in a Date Range

  • Use the formula:
=COUNT(C5:C10)-1

Counting values in date range using COUNT function in Excel


Example 5 – Highlight Values in a Date Range

The dataset contains Shipping Dates. To highlight cells between a start and end date:

dataset with start and end date

  • Select the values in the Shipping Date column >> go to the Home tab >> click Conditional Formatting >> select New Rule.

using conditional formatting to Highlight Values in Date Range in Excel

  • In New Formatting Rule, select Use a formula to determine which cells to format >> enter the following formula in the box >> click Format.
=AND(C5>$E$5,C5<$F$5)

New Formatting Rule Box

  • Choose Format and click OK.

Highlighted cells


Example 6 – Get a Range from Dates in Excel

=MIN(C5:C10)

Using MIN function to Get Range from Dates in Excel

=MAX(C5:C10)

Using MAX function to Get Range from Dates in Excel


How to Use the IF Formula with a Date Range in Excel

1. Use the IF Function Only to Create a Formula

You have a list of shipment dates and want to see Shipped in Column D if the values in Column C are in the list. Otherwise, an empty string.

  • Use the formula:
=IF(C5=$F$5,"Shipped",IF(C5=$F$6,"Shipped",IF(C5=$F$7,"Shippped",IF(C5=$F$8,"Shipped",IF(C5=$F$9,"Shipped",IF(C5=$F$10,"Shipped",""))))))

Using IF Function Only to Create IF Formula for Date Range

The formula checks if the value in C5 is equal to any of the values in F5:F10, and returns Shipped if there is a match. Otherwise, it returns an empty string.

2. Use the AND and the IF Functions

  • Use the following formula to return Shipped if the date is between a range. Otherwise, it will return Pending.
=IF(AND(C5>=$F$8,C5<=$G$8),"Shipped","Pending")

Applying AND & IF Functions for Date Range in Excel


3. Use the OR and the IF Functions

To check if a date belongs to a date range:

  • Use the formula:
=IF(OR(C5=$F$5,C5=$F$6,C5=$F$7,C5=$F$8,C5=$F$9,C5=$F$10),"Will be Delayed","")

Date Range with OR & IF Functions


4. Use the IF and the COUNTIF Functions

  • Use the formula:
=IF(COUNTIF($F$5:$F$10,C5),"Shipped","")

Using IF and COUNTIF Functions for Date Range in Excel


5. Use the IF and the TODAY Functions

  • Use the formula to determine the order status based on the value in Column C compared to the current date.
=IF(C5<=TODAY(),"Shipped","Pending")

Applying IF and TODAY Functions for Date Range in Excel


6. Using the IF and the SORT Functions

To check if a date range is in a specified order:

  • Use the following formula. It will return Yes if the date range is sorted and No if it is not.
=IF(SUM(--(C5:C10<>SORT(C5:C10,1,1,0)))=0,"YES","NO")

Checking Date Range Order Using IF and SORT Functions

Read More: How to Use IF Formula for Date Range in Excel


How to Use the SUMIFS Function with a Date Range in Excel

1. Use the SUMIFS Function Between Two Dates

The dataset contains product prices and shipping dates. To sum the prices with a shipping date between two dates:

  • Use the formula:
=SUMIFS(C5:C10, D5:D10, ">="&F5, D5:D10, "<="&G5)

SUMIF Between Two Dates in Excel


2. Sum Within a Dynamic Range using the current Date

To sum values based on a date range between today and 10 days after the current date:

  • Use the formula:
=SUMIFS(C5:C10, D5:D10, "<"&TODAY(), D5:D10, ">="&TODAY()-G5)

Sum Within Dynamic Range Based on Today's Date


3. Sum Between Two Dates using Another Criterion

To calculate the sum of product prices with a shipping date between two given dates and containing the word Black in the product name:

  • Use the formula:
=SUMIFS(C5:C10, D5:D10, ">="&F5, D5:D10, "<="&G5,B5:B10,"Black*")

Sum If Between Two Dates and Another Criteria


The Excel SUMIFS Function Between Dates is Not Working

Solutions:

  • Check the date and number format.
  • Make sure ranges are the same size.

 

Excel Date Range: Knowledge Hub


 

<< Go Back to Date-Time in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Arin Islam
Arin Islam

Anowara Islam Arin, a graduate of Civil Engineering from Khulna University of Engineering & Technology, Bangladesh, serves as a technical content creator in the ExcelDemy project. Possessing a passion for innovation and critical thinking, she actively embraces challenges. Beyond her engineering background, Arin exhibits a keen interest in Excel, having authored numerous articles on Excel & VBA-related issues to simplify the experience for users facing obstacles in Excel. Besides, she is also interested in Advanced Excel,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo