简体   繁体   English

在 Excel 工作表中创建数据验证

[英]Create Data Validation in Excel Sheet

I have a data validation issue.我有数据验证问题。

My cell reference should be 2 letters then 4 digits then 1 letter我的单元格参考应该是 2 个字母,然后是 4 个数字,然后是 1 个字母

As Example - AB1234A, xY0123z例如 - AB1234A, xY0123z

Need to consider Both simple and Capital as well.还需要考虑简单和资本。 Other way of input need to reject.其他输入方式需要拒绝。 快照

Use custom validation formula for that cell.为该单元格使用自定义验证公式。 Check if first 2 are letters with ISTEXT and LEFT formulas.检查前 2 个字母是否带有ISTEXTLEFT公式。 If 3rd, 4th, 5th and 5th are numbers with ISNUMBER and MID formulas, check if length is 7 symbols with LEN and so on.如果第 3、4、5 和 5 是带ISNUMBERMID公式的数字,请检查长度是否为 7 个符号,带LEN等等。 Wrap everything with ANDAND包裹一切

And you will get something like this:你会得到这样的东西:

=AND(LEN(C4)=7,ISTEXT(LEFT(C4,2)),ISNUMBER(VALUE(MID(C4,3,4))),ISNUMBER(RIGHT(C4,1)+1)=FALSE)

(Note that if you extract 1 symbol with LEFT , RIGHT or MID and it is a number it will be treated like text. Workaround is to add any number and check if it converts to a number (adding number to actual text would give value error) (请注意,如果您使用LEFTRIGHTMID提取 1 个符号,并且它是一个数字,它将被视为文本。解决方法是添加任何数字并检查它是否转换为数字(将数字添加到实际文本会给出值错误)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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