简体   繁体   中英

Excel - Text validation against cell range

I am looking to use Excel's data validation feature with text. I have a cell which will be compared against data found in a 4 cell data range (F22:F25). I have tried creating my own formula to test inputs. For example, Let's say F22:F25 had the following fruits: Apples, Grapes, Oranges, Pears. If cell B5 had either of these fruits then it a pop up window should appear indicating that the fruit is already within that range.

I have tried OR(B5<>F22, B5<>F23, B5<>F24, B5<>F25), the NOT function, and a couple of others. Am I missing something obvious?

Custom Data Validation is working for me. I am using excel 2010 (Windows 7).

I have F2 to F5 as Apples, Grapes, Oranges, Pears . I added Data validation in B2 such that =IF(COUNTIF($F$2:$F$5,$B$2)=0,TRUE,FALSE) with Allow drop down as Custom .

If I enter value in B2 which is in the ranges from F2 to F5 then count if becomes 1 so data validation fails. If I enter rest of data then works fine. Please refer below images.

DataValidation

ValidationOne

ValidationTwo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM