# Excel: Check if Date is Within 7 Days of Another Date

You can use the following formula to check if a specific date in Excel is within 7 days of another date:

```=IF((C2-B2)<=7,"Within 7","Not Within 7")
```

This particular formula checks if the date in cell C2 is within 7 days of the date in cell B2 and returns “Within 7” or “Not Within 7” accordingly.

The following example shows how to use this formula in practice.

## Example: Check if Date is Within 7 Days of Another Date in Excel

Suppose we have the following dataset in Excel that shows when various tasks were requested and when they were delivered by various employees at some company:

Suppose we would like to check if each task was delivered within 7 days of the request date.

We can type the following formula into cell D2 to do so:

`=IF((C2-B2)<=7,"Within 7","Not Within 7")`

We can then click and drag this formula down to each remaining cell in column D:

Column D returns either “Within 7” or “Not Within 7” depending on whether or not the request dates and delivery dates are within 7 days of each other.

If we’d like, we could also return values such as “Yes” or “No” instead:

`=IF((C2-B2)<=7,"Yes","No")`

We can enter this formula into cell D2 and click and drag it down to each remaining cell in column D:

Column D now returns either “Yes” or “No” to indicate whether or not the request dates and delivery dates are within 7 days of each other.