{"id":4,"date":"2020-07-29T13:38:02","date_gmt":"2020-07-29T13:38:02","guid":{"rendered":"http:\/\/hede.org\/?p=4"},"modified":"2020-08-18T12:09:18","modified_gmt":"2020-08-18T12:09:18","slug":"vbe-excel-function-for-extracting-age-from-danish-social-security-number-cpr-number","status":"publish","type":"post","link":"http:\/\/hede.org\/?p=4","title":{"rendered":"VBE -Excel Function for extracting age from danish Social security number ( CPR number)"},"content":{"rendered":"\n<pre class=\"wp-block-preformatted\"><strong>Public Function CPRAGE(InCPR As String, InpYear As String)<\/strong>\n<strong> Dim TAge As String<\/strong>\n<strong> Dim IAge As Integer<\/strong>\n<strong> Dim Placing As String<\/strong>\n<strong> Dim Pla As Integer<\/strong>\n<strong> Dim FinY As Integer<\/strong>\n<strong> 'converting<\/strong>\n<strong> 'extracting the right integers and converting integers into numbers<\/strong>\n<strong> 'year of birth<\/strong>\n<strong> IAge = Mid(InCPR, 5, 2)<\/strong>\n<strong> TAge = CInt(IAge)<\/strong>\n<strong> 'indicator of millenium of birth<\/strong>\n<strong> PlacingA = Mid(InCPR, 7, 4)<\/strong>\n<strong> Placing = CInt(PlacingA)<\/strong>\n<strong> 'converting year string into integer<\/strong>\n<strong> FinY = CInt(InpYear)<\/strong>\n\n<strong>If ((Placing &gt;= 4000 And Placing &lt;= 4999) And (TAge &gt;= 0 And TAge &lt;= 36)) Then<\/strong>\n<strong>Pla = 2000<\/strong>\n<strong>End If<\/strong>\n<strong> If ((Placing &gt;= 4000 And Placing &lt;= 4999) And (TAge &gt;= 37 And TAge &lt;= 99)) Then<\/strong>\n<strong>Pla = 1900<\/strong>\n<strong>End If<\/strong>\n<strong>If ((Placing &gt;= 5000 And Placing &lt;= 5999) And (TAge &gt;= 0 And TAge &lt;= 57)) Then<\/strong>\n<strong>Pla = 1900<\/strong>\n<strong>End If<\/strong>\n<strong>If ((Placing &gt;= 1 And Placing &lt;= 999) And (TAge &gt;= 1 And TAge &lt;= 150)) Then<\/strong>\n<strong>Pla = 1900<\/strong>\n<strong>End If<\/strong>\n<strong> If ((Placing &gt;= 1000 And Placing &lt;= 3999) And (TAge &gt;= 1 And TAge &lt;= 150)) Then<\/strong>\n<strong>Pla = 1900<\/strong>\n<strong>End If<\/strong>\n<strong>If ((Placing &gt;= 5000 And Placing &lt;= 8999) And (TAge &gt;= 0 And TAge &lt;= 57)) Then<\/strong>\n<strong>Pla = 2000<\/strong>\n<strong>End If<\/strong>\n<strong>CPRAGE = FinY - (Pla + TAge)<\/strong> <strong>'Jorgen Hede -All rights reserved 2016<\/strong> <strong>End Function<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Public Function CPRAGE(InCPR As String, InpYear As String) Dim TAge As String Dim IAge As Integer Dim Placing As String Dim Pla As Integer Dim FinY As Integer &#8216;converting &#8216;extracting the right integers and converting integers into numbers &#8216;year of birth IAge = Mid(InCPR, 5, 2) TAge = CInt(IAge) &#8216;indicator of millenium of birth PlacingA &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/hede.org\/?p=4\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;VBE -Excel Function for extracting age from danish Social security number ( CPR number)&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-4","post","type-post","status-publish","format-standard","hentry","category-codebits"],"_links":{"self":[{"href":"http:\/\/hede.org\/index.php?rest_route=\/wp\/v2\/posts\/4","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hede.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hede.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hede.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hede.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4"}],"version-history":[{"count":3,"href":"http:\/\/hede.org\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions"}],"predecessor-version":[{"id":44,"href":"http:\/\/hede.org\/index.php?rest_route=\/wp\/v2\/posts\/4\/revisions\/44"}],"wp:attachment":[{"href":"http:\/\/hede.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hede.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hede.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}