Excel Date Range (Learn and Apply)

Want to know about a date range in Excel? Then, this is the right place for you. In this article, you will find ways to create date ranges, different examples of date ranges, and learn how to apply different Excel functions in a date range. You will also learn to filter, sort and look up data from date ranges using formulas.

The date range in Excel can be used for various fields, including data analysis, financial management, project management, sales and marketing, HR, inventory management, planning, and personal time management.

Overview image of Excel Date Range


Download Practice Workbook


How to Create Date Range in Excel

  • Here, we have a dataset containing the start and end dates of some events in Excel.

dataset

  • We can show the date range for each event in a single cell using the TEXT function. To do that we used the following formula.
=TEXT(C5,"dd mmm")&" - "&TEXT(D5,"dd mmm")

creating date range using Text function


Date Range in Excel: 6 Ideal Examples

1. Use IF and TEXT Functions to Create Date Range When Start or End Date Is Missing

  • In the above dataset, if the start date or end date is missing, you can create a date range using the IF function along with the TEXT function.
  • We used the following formula to return only the start date if the end date is missing and return an empty string when 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


2. Date Range Starting from Today and Adding Number

  • Suppose we want to make a dataset where the first Project starts today. Each project takes 2 months to finish and starts 2 days after the previous project has finished.
  • Using the TODAY function, you can insert the current date in your Excel worksheet. Use the following formula to do that.
=TODAY()

Using TODAY function

  • Suppose we want the end date of Project A to be after 2 months or 60 days of the start date. In that case, we will simply add 60 to Cell C5 to get the value.
=C5+60

Adding number to date

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

Adding number

  • Now, if you autofill the rest of the cells using the Fill Handle tool, you will get a dataset like below.

After auto filling date range in Excel


3. Create a Date Sequence in Excel

  • Suppose you want to create a date sequence having a 3-day interval between them.
  • Insert the first 2 dates and select them.
  • Then, drag down the Fill Handle tool to copy the pattern.

Creating Date Sequence in Excel using Fill Handle tool

  • Clicking on the square box, you will get other options to fill your dataset.

Created Date Sequence


4. Count Values in Date Range

  • To count values in a data range, you can use the COUNT function in Excel. Here is the formula to do that.
=COUNT(C5:C10)-1

Counting values in date range using COUNT function in Excel


5. Highlight Values in Date Range

  • Now, we have a dataset containing the Shipping Date of some products. However, we want to highlight only the cells between a certain start and end date.

dataset with start and end date

  • To do that, select the values of the Shipping Date column >> go to the Home tab >> click on Conditional Formatting >> select New Rule.

using conditional formatting to Highlight Values in Date Range in Excel

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

New Formatting Rule Box

  • Choose your desired formatting and click OK. Thus, you can highlight values in a date range.

Highlighted cells


6. Get Range from Dates in Excel

  • To get the minimum value from a date range you can use the MIN function in Excel.
=MIN(C5:C10)

Using MIN function to Get Range from Dates in Excel

  • To get the maximum value from a date range you can use the MAX function in Excel.
=MAX(C5:C10)

Using MAX function to Get Range from Dates in Excel


How to Use IF Formula for Date Range in Excel

To return values depending on different conditions from a date range in Excel, you can use the IF function along with other Excel functions.

1. Use IF Function Only to Create IF Formula for Date Range

  • Suppose we have a list of dates that represents the actual dates of shipments. If the values in Column C consist of those in that list, we want to return Shipped in Column D, otherwise, it will return an empty string.
  • To do that, we used the following formula using the nested IF function.
=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

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

2. Apply AND & IF Functions for Date Range in Excel

  • If you want to check if a date range fulfills two conditions at the same time, you can use the IF and AND functions in Excel.
  • Here, we used the following formula to return Shipped if the date is in 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. Date Range with OR & IF Functions

  • Using the OR and IF functions in Excel you can check if a date belongs to a certain date range. To do that, use the following 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 IF and COUNTIF Functions for Date Range in Excel

  • You can also use the IF and COUNTIF functions to do the same task.
=IF(COUNTIF($F$5:$F$10,C5),"Shipped","")

Using IF and COUNTIF Functions for Date Range in Excel


5. Apply IF and TODAY Functions for Date Range in Excel

  • To compare a date range with the current date, you can use the TODAY and IF functions in Excel.
  • We used the following formula, to determine the status of orders 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. Check Date Range Order Using IF and SORT Functions

  • To check if a date range is in a certain order or not you can use the IF and SORT function in Excel.
  • Use the following formula to do that. 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 SUMIFS with Date Range in Excel

Now, we will show you how you can sum values if it is within a certain date range. To do that we’ll use the SUMIFS function.

1. SUMIFS Between Two Dates in Excel

  • Here, we have a dataset containing some products’ prices and shipping dates. We want to sum up the prices of the products which have a shipping date within a certain date range.
  • To do that, we used the following formula.
=SUMIFS(C5:C10, D5:D10, ">="&F5, D5:D10, "<="&G5)

SUMIF Between Two Dates in Excel


2. Sum Within Dynamic Range Based on Today’s Date

  • To sum values based on a date range that starts from today and extends 10 days after that, you can use the TODAY function within the SUMIFS formula to set the criteria.
=SUMIFS(C5:C10, D5:D10, "<"&TODAY(), D5:D10, ">="&TODAY()-G5)

Sum Within Dynamic Range Based on Today's Date


3. Sum If Between Two Dates and Another Criterion

  • To calculate the sum of prices for products with a shipping date between two given dates and containing the word Black in the product name, we will use the following formula.
=SUMIFS(C5:C10, D5:D10, ">="&F5, D5:D10, "<="&G5,B5:B10,"Black*")

Sum If Between Two Dates and Another Criteria


[Fixed!] Excel SUMIFS Between Dates Not Working

When the SUMIFS function between dates is not working or returns wrong values in Excel, you can solve it using the solutions we have provided below.

  • Check the format of dates and numbers: If your result using the SUMIFS function is zero, check if the dates are in text format which seems like a date.
  • Use correct syntax for criteria: If you are inserting a date value insert it inside the quotation marks (“>=10/1/2023”) and insert cell references or functions outside quotation marks ( “>=”&C5 or “<“&TODAY())
  • Verify formula logic: Make sure you have inserted the right logic into the formula.
  • Make sure all ranges are the same size: In the formula, the sum_range and criteria_range should be equal, otherwise it will return #Value! Error. To avoid this, make sure to have the same size ranges.

Things to Remember

Make sure to convert the dates into Date format rather than Text format which looks like dates.


Frequently Asked Questions

1. What do you mean by date range in Excel?

Date ranges in Excel can convert values to text with a specified format, calculate the duration between two given dates, and set up date ranges by formatting cells as ‘date’ and using the addition (+) or subtraction (-) operations with the end date or desired duration.

2. How to calculate the difference between the two dates?

To calculate the differences between two dates you can use general operations such as “+” or “-”. For example: =(C5-B5).


Excel Date Range: Knowledge Hub


Conclusion

In this article, you will have a thorough understanding of date range in Excel. It covers various topics such as creating date ranges, practical examples, using Excel functions, filtering, sorting, data lookup using formulas, using Excel features, and even using VBA for date range operations. Hope you find this helpful and informative. Feel free to comment if something seems difficult to understand. Thank you!


<< 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