老身份证15位转18位的公式是什么?
步骤如下:首先在EXCEL宏编程里新建一函数id15to18(),输入代码:Public Function ID15to18(sCode15 As String) As String Dim i, num As Integer
Dim code As String
num = 0
IDCode = Left(sCode15, 6) + "19" + Right(sCode15, 9)
For i = 18 To 2 Step -1
num = num + (2 ^ (i - 1) Mod 11) * (Mid(IDCode, 19 - i, 1))
Next i
num = num Mod 11
Select Case num
Case 0
code = "1"
Case 1
code = "0"
Case 2
code = "X"
Case Else
code = Trim(Str(12 - num))
End Select
IDCode = IDCode + code
End Function 自定义函数ID15to18() 2、保存后直接在EXCEL里调用就可以了。例:A列是15位身份证号 B例要求是18位身份证号 A1 B1=ID15to18(A1)