To allow only values that contain a specific text string, you can use data validation with a custom formula based on the FIND and ISNUMBER functions. In the example shown, the data validation applied to C5:C9 is:
Data validation rules are triggered when a user adds or changes a cell value.
In this formula, the FIND function is configured to search for the text "XST" in cell C5. If found, FIND will return a numeric position (i.e. 2, 4, 5, etc.) to represent the starting point of the text in the cell. If the text is not found, FIND will return an error. For example, for cell C5, FIND will return 5, since "XST" starts at character 5.
The result returned by the FIND function is then evaluated by the ISNUMBER function. For any numeric result returned by FIND, ISNUMBER will return TRUE and validation will succeed. When text isn't found, FIND will return an error, ISNUMBER will return FALSE, and the input will fail validation.
Must not contain
To validate input only when a cell does not contain specific text, you can replace the ISNUMBER function with ISERROR like this:
Note: Excel has several built-in data validation rules for numbers. This page explains how to create a your own validation rule based on a custom formula. To allow only numbers in a cell, you can use data validation with a custom formula based on...
To allow only text in a cell, you can use data validation with a custom formula based on the ISTEXT function. In the example shown, the data validation applied to C5:C9 is: = ISTEXT ( C5 ) How this formula works Data validation rules are triggered...
To disallow input that contains one of many things, you can use a custom data validation rule based the SEARCH function. In the example shown, the data validation applied to B5:B11 is: = SUMPRODUCT ( -- ISNUMBER ( SEARCH ( list , B5 ))) = 0 How this...
The Excel ISNUMBER function returns TRUE when a cell contains a number, and FALSE if not. You can use ISNUMBER to check that a cell contains a numeric value, or that the result of another function is a number.
Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.