Using WPS form to extract ID letter

Source: Internet
Author: User

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 D2, 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 E2, 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):

The formula is detailed: Len is the length function, mid is to extract the character function, text is the conversion format function, mod is the division function, if is the Judge 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 17th 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.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.