How to discard invalid dates in Excel

This example explains how to use data validation to discard invalid dates.

  1. Highlight a range A2: A4.
  2. On the Advanced tab Data (data) click Data Validation (Data validation).How to discard invalid dates in Excel

Out of date range

  1. From drop down list Allow (data type) select item Date (Date).
  2. From drop down list Data (Value) select item Between (Between).
  3. Enter the start and end date as shown in the picture below and click OK.How to discard invalid dates in ExcelExplanation: Dates between May 20, 2013 and today + 5 days are allowed. Dates outside this range are invalid.
  4. Type in cell A2 the date is May 19, 2013.

Result: Excel issues an error message.

How to discard invalid dates in Excel

Note: To specify an input hint or text to alert you to an error, click the tab Input Message (Message for input) or Error Alert (Error message).

Sundays and Saturdays

  1. From drop down list Allow (data type) select item Custom (Another).
  2. In the Formula (Formula) Enter the formula shown below and click OK.

    =AND(WEEKDAY(A2)<>1,WEEKDAY(A2)<>7)

    =И(ДЕНЬНЕД(A2)<>1;ДЕНЬНЕД(A2)<>7)

    How to discard invalid dates in Excel

    Explanation: Function WEEKDAY (WEEKDAY) returns a number between 1 (Sunday) and 7 (Saturday) representing the day of the week. If the day of the week is neither 1 (Sunday) nor 7 (Saturday), the date is allowed (<> means not equal). In other words, Mondays, Tuesdays, Wednesdays, Thursdays and Fridays are valid. Sundays and Saturdays – no. Since, before opening the data validation window, we selected the range A2: A4, Excel automatically inserted the formula into all cells in that range.

  3. To check this, select a cell A3 And click the Data Validation (Data validation).How to discard invalid dates in ExcelAs you can see in the figure, this cell also contains a formula.
  4. Enter the date August 24, 2013 (Saturday) in the cell A2.

Result: Excel issues an error message.

How to discard invalid dates in Excel

Note: Click the tab Input Message (Message for input) or Error Alert (Error Message) to write an input hint or text to alert you to an error.

Leave a Reply