Go Back

Data validation must not contain

Read time: 15 minutes

In excel, we can easily disallow an input which contains one of many things. To do this, we can use a validation rule which utilizes the SEARCH function. In this article, we shall look at how one can carry out data validation must not contain something else in excel.

Figure 1: Data validation in Excel

General syntax of the formula

=SUMPRODUCT (--ISNUMBER (SEARCH (list, column to validate)))=0

Understanding the formula

The formula above plays a fundamental role when we want to disallow inputs that contain one or many things.

How the formula works

  • Data validation formula utilizes the SEARCH function when testing an input for each value that are in the list.
  • The function uses the logic “contains”
  • In the event that a value is found in the list, the SEARCH function will return its position as a number.
  • When no value is found, the SEARCH function will return an error.
  • The numbers will then be converted to TRUE while the errors to FALSE by the ISNUMBER function.
  • These TRUE and FALSE strings are then converted to 1s and 0s by the double negative operator.
  • These items are then summed up by the SUMPRODUCT function and then the result is tested against zero.
  • Validation will occur if all items are zero and the SUMPRODUCT returns a zero. But if it returns any other number, then a FALSE is returned, meaning validation has failed.

Cell references when doing data validation applies to the upper left cell in the range that you have selected as of the moment the data validation rule is being entered.

Instant Connection to an Expert through our Excelchat Service

Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.

Did this post not answer your question? Get a solution from connecting with the expert.

Another blog reader asked this question today on Excelchat:
Here are some problems that our users have asked and received explanations on

Data Validation is not way too small to read
Solved by D. J. in 18 mins
Data validation question. With a formula that is not working properly.
Solved by Z. J. in 20 mins
Trying to run a regression but comes up with the message: Regression - input range must contain at least one data point
Solved by I. Q. in 18 mins

Leave a Comment