如何利用Excel函数识别身份证号码

2020-09-21 社会 152阅读
权当身份证号码在A2单元格
有两个验证公式
18位单一校验:
=IF(AND(LEN(A2)=18,CHOOSE(MOD(SUMPRODUCT(MID(A2,ROW($1:$17),1)*2^(18-ROW($1:$17))),11)+1,1,0,"X",9,8,7,6,5,4,3,2)&""=RIGHT(A2)),"有效","无效!!")
通用(18位、15位均可)校验:
=IF(LEN(A2)=18,IF(CHOOSE(MOD(SUMPRODUCT(MID(A2,ROW($1:$17),1)*2^(18-ROW($1:$17))),11)+1,1,0,"X",9,8,7,6,5,4,3,2)&""=RIGHT(A2),"正确","错误"),IF(LEN(A2)=15,IF(CHOOSE(MOD(SUMPRODUCT(MID(A2,ROW($1:$14),1)*2^(15-ROW($1:$14))),11)+1,1,0,"X",9,8,7,6,5,4,3,2)&""=RIGHT(A2),"正确","错误"),"错误"))
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com