Excel 身份证信息验证公式

Excel 身份证信息验证公式,A1 是身份证号所在单元格

验证全部:

=IF(A1="","",(IF(MID("10X98765432",MOD(SUMPRODUCT(MID(A1,ROW(INDIRECT("1:17")),1)*2^(18-ROW(INDIRECT("1:17")))),11)+1,1)=MID(A1,18,18),"正确","错误")))

验证全部:

=IF(LOOKUP((LEFT(A1,1)*7+MID(A1,2,1)*9+MID(A1,3,1)*10+MID(A1,4,1)*5+MID(A1,5,1)*8+MID(A1,6,1)*4+MID(A1,7,1)*2+MID(A1,8,1)+MID(A1,9,1)*6+MID(A1,10,1)*3+MID(A1,11,1)*7+MID(A1,12,1)*9+MID(A1,13,1)*10+MID(A1,14,1)*5+MID(A1,15,1)*8+MID(A1,16,1)*4+MID(A1,17,1)*2)-ROUNDDOWN((LEFT(A1,1)*7+MID(A1,2,1)*9+MID(A1,3,1)*10+MID(A1,4,1)*5+MID(A1,5,1)*8+MID(A1,6,1)*4+MID(A1,7,1)*2+MID(A1,8,1)+MID(A1,9,1)*6+MID(A1,10,1)*3+MID(A1,11,1)*7+MID(A1,12,1)*9+MID(A1,13,1)*10+MID(A1,14,1)*5+MID(A1,15,1)*8+MID(A1,16,1)*4+MID(A1,17,1)*2)/11,0)*11,{0,1,2,3,4,5,6,7,8,9,10},{"1","0","x","9","8","7","6","5","4","3","2"})=RIGHT(A1,1),"正确","错误")

验证最后一位:

=IF(LEN(A1)<>18,"非二代身份证",IF(MID("10X98765432",(MOD(SUMPRODUCT(MID(A1,ROW(INDIRECT("1:17")),1)*{7;9;10;5;8;4;2;1;6;3;7;9;10;5;8;4;2}),11)+1),1)=RIGHT(A1),"正确","错误"))

验证出生日期:

=MID(A1,7,8)

验证性别:

=IF(MOD(MID(A1,17,1),2)=1,"男","女")
点赞