How a NHS number is validated
Below are the steps performed by the NHSNumberValidator to confirm that a NHS number is correct.
A NHS number is validated using 6 steps. We will use the example number 174543891
Step One
Multiply each of the first nine digits by a weighting factor based on its position. Use the below table as a guide
| Position of the identifier | Multiply by factor |
|---|---|
| 1 | 10 |
| 2 | 9 |
| 3 | 8 |
| 4 | 7 |
| 5 | 6 |
| 6 | 5 |
| 7 | 4 |
| 8 | 3 |
| 9 | 2 |
For example the position of the first digit is 1 and so it will be multiplied by 10. The number positioned at 2 will be multiplied by 9 and so on.
Step Two
Find the sum of all the results as shown below:
|
1 |
n = (1 x 10) + (7 x 9) + ( 4 x 8 ) + (5 x 7) + (4 x 6) + (3 x 5) + (8 x 4 ) + (9 x 3) + (1 x 2) |
Therefore n is equal to 240
Step Three
Divide the total by 11 and gain the remainder. In this case our total is 240 so the calculation would be:
|
1 |
n % 11 |
Therefore n is equal to 9
Step Four
Subtract the total of n (The remainder) from 11. This will give us the Check digit. In this case it would be:
|
1 |
c = 11 - 9 |
Therefore c is equal to 2
Step Five
The result of c is the check digit. There are two conditions that will alter the check digit. The first is when the check digit is 11. If this is the case the the check digit will be changed to 0. The second case is when the check digit equals 10. If this is the case then the identifier is wrong.
In our case the check digit stays as 2
Step Six
This is the last stage in validating the NHS number. If the check digit has passed set five then compare the check digit with the 10th digit in the NHS number. If its the same then the NHS number is correct. If its not the its invalid. In this example the last digit of the NHS number is 1 and our check digit has been calculated as 2. Therefore this NHS Number is wrong

Recent Comments