NIKs in Excel: formulas for birth date, age, and gender
Updated 13 October 2026
Have a column of Indonesian NIKs in Excel or Google Sheets? Two things must be right before any formula works: the NIK has to be stored intact, and each segment has to be cut at the right position. What each segment means is explained on the NIK decoder page.
How to stop Excel turning a NIK into 1.27E+15
Excel stores numbers to 15 significant digits. A NIK has 16, so the moment it is typed or pasted as a number the last digit becomes 0 and it displays as 1.27118E+15. The data is permanently altered, not just displayed differently, and changing the cell format afterwards does not bring the lost digit back. Three ways to keep it intact:
- Format the column as Text before typing. Select the column, right-click, Format Cells, then Text.
- Start with an apostrophe, as in '1271182308840005. The apostrophe is not displayed.
- When pasting from elsewhere, use Paste Special, then Text, or import the CSV with the NIK column set to Text.
Google Sheets has the same limit. If the NIKs in your file already end in 0, fetch them again from the original source; no formula can recover the lost digit.
Excel formulas: birth date, age, and gender from a NIK
The NIK is in cell A2, stored as text. The day is at position 7 for 2 digits, the month at 9, the year at 11. A day above 40 marks a female holder; subtract 40 for the real day.
| Result | Formula |
|---|---|
| Gender | =IF(VALUE(MID(A2,7,2))>40,"F","M") |
| Day (1–31) | =IF(VALUE(MID(A2,7,2))>40,VALUE(MID(A2,7,2))-40,VALUE(MID(A2,7,2))) |
| Month | =VALUE(MID(A2,9,2)) |
| Year (century guessed) | =IF(VALUE(MID(A2,11,2))<=VALUE(RIGHT(YEAR(TODAY()),2)),2000,1900)+VALUE(MID(A2,11,2)) |
| Full birth date | =DATE(IF(VALUE(MID(A2,11,2))<=VALUE(RIGHT(YEAR(TODAY()),2)),2000,1900)+VALUE(MID(A2,11,2)),VALUE(MID(A2,9,2)),IF(VALUE(MID(A2,7,2))>40,VALUE(MID(A2,7,2))-40,VALUE(MID(A2,7,2)))) |
| Age in years, birth date in B2 | =DATEDIF(B2,TODAY(),"Y") |
| 6-digit region code | =LEFT(A2,6) |
The formulas use commas as argument separators. If your Excel uses semicolons, replace every comma with a semicolon. The two-digit year is guessed the same way as the tool on this page: years not yet past are read as 20xx, the rest as 19xx. To turn region codes into names, download the code list on the region codes page and use VLOOKUP.
If you have hundreds of rows and would rather skip formulas, paste the NIK column into the box at the top. The result table can be copied as TSV and pasted next to your NIK column.