UK NI Number (NINO) Validation

  • I didn't technically create this, just saw a regex for it in the DOM Explorer when using a form on the HMRC website, so chucked it into a function as it's something I've seen asked for a few times - tweaked a little to not allow things such as "AB123456C" so the format should be any of the allowed prefixes, followed by 6 numbers and a letter from A-D

    Either use in VBA:

    Dim valid As Boolean, testNINO As String
    testNINO = "AB123456C"
    valid = IsValidNINO(testNINO)
    MsgBox testNINO & " is " & IIf(valid, vbNullString, "not ") & "a valid NINO."

    Or as a worksheet function:


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!