top of page

You are learning Data Validation in MS Excel

How to use data validation to prevent data entry on specific days of the week?

Here's how to use data validation to prevent data entry on specific days of the week in Excel:

1. Select the cells: Choose the cell(s) where you want to restrict data entry based on weekdays. You can select a single cell or a range of cells.

2. Go to Data Validation: Navigate to the "Data" tab on the Excel ribbon. In the "Data Tools" group, click "Data Validation."

3. Set Allow to Custom: In the "Settings" tab of the Data Validation window, under "Allow," choose "Custom" from the dropdown menu.

4. Create the formula: In the "Formula" box, enter the following formula:

```excel
=WEEKDAY(A1,2)<>6
```

Explanation of the formula:

- `WEEKDAY(A1,2)`: This part uses the WEEKDAY function. "A1" is the cell reference you want to validate (replace A1 with your actual cell if different). The `2` argument specifies a Monday-based week numbering system (1 for Sunday-based).
- `<>6`: This checks if the result of the WEEKDAY function (day of the week number) is not equal to 6 (Saturday).

5. Error message (Optional): You can customize the error message that appears when someone tries to enter a date on a weekend. In the "Input Message" box, type a clear message explaining the restriction (e.g., "Weekends not allowed").

6. Error title (Optional): Similarly, you can set an error title in the "Show error message if invalid value is entered" box (e.g., "Invalid Date Entry").

7. Click OK: Click "OK" to close the Data Validation window.

With this setup, Excel will only allow data entry in the selected cells if the corresponding date falls on a weekday (Monday to Friday). Any attempt to enter a date on a Saturday or Sunday will trigger the custom error message.

bottom of page