Check If Date Is Within 7 Days of Another Date in Excel (7 Ways)

Sometimes, you may need to know in Excel whether a Data is within 7 days of another Date. Thus, in this article, I will describe how to use Excel to know if a Date is within 7 days of another Date.


How to Know If a Date is Within 7 Days of Another Date: 7 Handy Methods

Here, I will demonstrate 7 suitable methods with detailed steps of how to use Excel if a Date is within 7 days of another Date. For your better understanding, I am going to use the following dataset. Which contains three columns. Those are Product, Order Date and Delivery Date. The dataset is given below.

Excel If a Date is Within 7 Days of Another Date


1. Use of IF Function to Know Whether a Date Is Within 7 Days of Another Date

You can apply the IF function to know whether a Date is within 7 days of another Date. Furthermore, you can modify this function for different types of results according to your preference. The steps are given below.

Steps:

  • Firstly, you have to select a new cell E5 where you want to keep the result.
  • Secondly, you should use the formula given below in the E5 cell.
=IF((D5-C5)<7,"Successful","Late")

Use of IF Function to Know Whether a Date is Within 7 Days of Another Date

Formula Breakdown

Here, the IF function will return a logical test result.

  • Firstly, (D5-C5)<7 denotes the logical test. This test will check whether the subtraction of the cell value C5 from D5 is less than 7 or not.
  • Secondly, “Successful” —> When the Date difference is less than 7 then it will return Successful. Here, an Inverted Comma is a must for getting a text as the output.
  • Lastly,“Late” —> denotes that when the logic fails then it will return Late.

  • After that, you must press ENTER to get the result.

  • Now, you can drag the Fill Handle icon to AutoFill the corresponding data in the rest of the cells E6:E11.

Finally, you will get all the results. When the date is within 7 days of another date the Status becomes Successful.


2. Employing DAYS Function

You can use the DAYS function to know whether a Date is within 7 days of another Date. The steps are given below.

Steps:

  • Firstly, you have to select a new cell E5 where you want to keep the result.
  • Secondly, you should use the formula given below in the E5 cell.
=DAYS(D5,C5)

Here, in this formula the DAYS function will return the day’s duration between two dates. In addition, D5 and C5 denote respectively the end date and the start date.

  • Subsequently, press ENTER to get the result.

Use of DAYS Function to Know Whether a Date is Within 7 Days of Another Date

  • Now, double-click on the Fill Handle icon to autofill the corresponding data range E6:E11.

Lastly, you can see the duration between the two dates.


3. Use of Combined Functions to Know Whether a Date Is Within 7 Days of Another Date

You can employ a combination of some functions like the IF function, AND function, and TODAY function to know whether a Date is within 7 days of another Date. Furthermore, you can modify these functions for different types of results according to your preference. The steps are given below.

Steps:

  • Firstly, you have to select a new cell E5 where you want to keep the result.
  • Secondly, you should use the formula given below in the E5 cell.
=IF(AND((TODAY() - C5) - 7 > 0,C5<TODAY()), "Done", "Processing")
  • Finally, press ENTER to get the result.

Use of Combined Functions to Know whether a Date is Within 7 Days of Another Date

Formula Breakdown

  • Here, the TODAY function will return the current date.
    • Output:  02-Sep-22.
  • Then, the AND function will return TRUE or FALSE based on given logical tests.
  • Firstly, ((02-Sep-22) – C5) —>denotes the subtraction of the cell value C5 from 02-Sep-22 date.
    • Output: -1.
  • Secondly,  -1 – 7 > 0  —> becomes FALSE.
  • Thirdly, C5<TODAY() —> also, turns FALSE.
  • Fourthly, the IF function will check the logical test. When the logical test becomes right then it will return Done. Otherwise, it will return Processing. Here, Inverted Comma is a must for getting a text as the output.
    • Output: —> Processing. 

  • Now, you can drag the Fill Handle icon to AutoFill the corresponding data in the rest of the cells E6:E11.

Lastly, you will see all the results. When the date is within the past 7 days of the present date the Status becomes Processing.


4. Applying IF & AND Functions

You can apply the IF, and the AND functions to know whether a Date is within 7 days of another Date in Excel. Furthermore, you can modify this method for different types of results according to your preference. The steps are given below. If you notice the dataset then you can see that there is extra information in my dataset. Which is a target date in the D13 cell.

Steps:

  • Firstly, you have to select a new cell E5 where you want to keep the result.
  • Secondly, you should use the formula given below in the E5 cell.
=IF(AND(D5<=$D$13,(D5-C5)<=7),"Successful","Late")
  • Finally, press ENTER to get the result.

Use of IF & AND Functions to Know whether a Date is Within 7 Days of Another Date

Formula Breakdown

  • Here, the AND function will return TRUE or FALSE based on given logical tests.
  • Firstly, D5<=$D$13 —> denotes the Delivery Date should be less than or equal to the target Date.
    • Output: TRUE.
  • Secondly,  (D5-C5)<=7  —> denotes another logical test. Which is the subtraction of the cell value C5 from D5 should be less than or equal 7.
    • Output: TRUE.
  • Thirdly, AND(D5<=$D$13,(D5-C5)<=7) —> becomes TRUE.
  • Fourthly, the IF function will check the logical test. When the logical test becomes true then it will return Successful. Otherwise, it will return Late. Here, an Inverted Comma is a must for getting a text as the output.
    • Output: —> Successful.

  • Now, you can drag the Fill Handle icon to AutoFill the corresponding data in the rest of the cells E6:E11.

Lastly, you will see all the results. When the delivery date is within 7 days of another date the Status becomes Successful.


5. Employing Conditional Formatting

Here, you can use Conditional Formatting to know whether a Date is within 7 days of another Date in Excel. Basically, using this formatting you can identify all the dates which are within 7 days of another date at a glance. The steps are given below.

Steps:

  • Firstly, you should select the data range for which you want to apply the Conditional Formatting. Here, I have selected the data range D5:D11.
  • Secondly, from the Home tab >> you need to go to the Conditional Formatting feature.
  • Thirdly, select the New Rule… option.

Application of Conditional Formatting to know whether a Date is within 7 days of another Date

At this time, a dialog box named New Formatting Rule will appear.

  • Now, from that dialog box >> you have to select Use a formula to determine which cells to format.
  • Then, you need to write down the following formula in the Format values where this formula is true: box.
=(D5-C5)<7

This formula will check whether the subtraction of the cell value C5 from D5 is less than 7 or not.

  • After that, go to the Format menu.

At this time, a dialog box named Format Cells will appear.

  • Now, from the Fill option >> you have to choose any of the colors. Here, I have chosen Green. In this case, try to choose any light color. Because the dark color may hide the inputted data. Then, you may need to change the Font Color.
  • Then, you must press OK to apply the formation.

  • After that, you have to press OK on the New Formatting Rule dialog box. Here, you can see the sample instantly in the Preview box.

Finally, you will get the colored Dates which are within 7 days of another date.


6. Using the Data Validation Tool to Know If a Date Is Within 7 Days of Another Date

You can also use the Data Validation Tool to insert data for the dates that are within 7 days of another Date. Basically, using this tool you can insert any text as data only in those cells which will fulfill the given condition. The steps are given below.

Steps:

  • Firstly, select the cell range where you want to insert any data.
  • Secondly, from the Data tab >> go to the Data Tools option.
  • Finally, from the Data Validation feature >> choose the Data Validation… option.

Using Data Validation Tool to Know If a Date is Within 7 Days of Another Date

At this time, a dialog box named Data Validation will appear.

  • Now, from the Settings menu >> choose Custom in the Allow: box.
  • Then, write down the following formula in the Formula box.
=(C5+7)>D5

This formula will check whether the summation of the cell value C5 with 7 is greater than the D5 cell value or not.

  • Lastly, press OK to make the changes.

As you can see, when you try to insert any data in the cell which don’t fulfill the condition then you will get a Microsoft Excel declaration.

Finally, you will see the following result.


7. Use of “A Date Occurring” Feature

Here, you can use the Conditional Formatting again in a different way to know whether a Date is within 7 days of another Date. Basically, using this formatting you can identify all the dates which are within 7 days of another date at a glance. The steps are given below.

  • Firstly, you should select the data range for which you want to apply the Conditional Formatting. Here, I have selected the data range D5:D11.
  • Secondly, from the Home tab >> you need to go to the Conditional Formatting feature.
  • Thirdly, from the Highlight Cells Rules feature >> you need to choose the A Date Occurring… option.

Use of A Date Occurring feature to know whether a Date is within 7 days of another Date

At this time a dialog box named A Date Occurring will appear.

  • Now, choose In the last 7 days option through the drop-down arrow from the Format cells that contain a date occurring: box.
  • Then, select the preferred color from the drop-down arrow. Here, I have selected the Green Fill with Dark Green Text option.
  • Finally, press OK to get the changes.

Finally, you will get the colored dates which are within 7 days of another date.


💬 Things to Remember

  • If you simply want to know whether a Date is within 7 days of another Date, then you can use method 2 (DAYS function).
  • In the case of, you want any logical result with the current Date. Then, you should use method 3 (Combination of functions).

Practice Section

Now, you can practice the explained method by yourself.

Practice Section to know whether a Date is within 7 days of another Date


Download Practice Workbook

You can download the practice workbook from here:


Conclusion

I hope you found this article helpful. Here, I have explained 7 suitable methods to understand If a Date is within 7 Days of another Date. Please, drop comments, suggestions, or queries if you have any in the comment section below.


<< Go Back to Dates | Compare | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Musiha Mahfuza Mukta
Musiha Mahfuza Mukta

Musiha Mahfuza Mukta is a marine engineer who loves exploring Excel and VBA programming. To her, programming is a time-saving tool for dealing with data, files, and the internet. She's skilled in Rhino3D, Maxsurf, C++, MS Office, AutoCAD, and Excel & VBA, going beyond the basics. With a B.Sc in Naval Architecture & Marine Engineering from BUET, she's shifted gears and now works as a content developer. In this role, she creates techy content exclusively focused on Excel... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo