Recently, the unit needs to report a staff information, including personal identity card number, and the date of birth, gender and other information. Due to a large number of people, input is really troublesome, and error prone, not to get rework. Can have a once and for all, quickly and accurately enter the date of birth, sex and other personal information? I can! Because the ID number contains these personal information, we use the WPS form can easily extract some personal information in order to achieve automatic entry, and thus quickly and accurately completed the work.
At present, our country's ID card number is divided into two kinds, one is 15 digits, one is 18 bits. In the 15-bit old version of the ID card, the 7th to 12th digit is the date of birth, the last one is sex code, even number is female, odd is male. The 7th to 14th digit of the 18-digit new ID card is the date of birth, the 2nd digit is the sex code, the same even number is female and the odd number is male.
Based on this feature, we can use the function to judge. Figure 1 is the employee information form that we have entered the ID card number, we should pay attention when entering the ID number, we should make the cell format text type, or add a single quotation mark "'" to the ID card number before the transmission.
1. Extraction Date of birth
In C2, enter the formula "=if (C2) =15,text (Mid (c2,7,6)," 0 days "), TEXT (Mid (c2,7,8)," 0 days ")", drag the fill handle down to copy the formula, This completes the extraction of the date of birth (Figure 2):
2, the extraction of gender information
In D2, enter the formula "=if (MOD (C2) =15,mid (c2,15,1), MID (c2,17,1)), 2 = 1," Male "," female "), drag the fill handle down to copy the formula, thus completing the extraction of the sex information (Figure 3):
Formula Details: Len is the length function, mid is the extract character function, text is the conversion format function, mod is the division function, if is the judgment function. The date of birth formula means that if the ID number is 15 digits, the 6 characters from the 7th position are converted to the format of "0 days", otherwise (i.e. 18 ID), the 8 characters from the 7th digit are converted to the "0 days" format. The formula for the extraction of gender information means that if the ID number is 15 digits, divide the 15th and 2 evenly, if divided, shown as female, not divisible, shown as male, ID number 18 digits, the 15th and 2 divisible, if the division, display as female, not divisible, shown as male. In addition, if you want to convert your birth date to a true date type, simply add two minus signs to the formula in front of text, which is the offload operation, and then set the specific date type of the cell as needed.
The above is only in the correct situation of ID card entry set, if the ID card number input error, such as the number is wrong, the date information is wrong (such as the monthly score of more than 12, the number of days in February there are 31st), how to do? or leave it to everyone to think about it! Learn to extrapolate yo.