Prompt
Answer
Validation of Canadian Social Insurance Number (SIN) in Excel
Overview
The Canadian Social Insurance Number (SIN) is a unique identifier used for various governmental purposes. To validate a SIN, the number must adhere to a specific format and pass a checksum verification using the Luhn algorithm.
Formula for Validation
Below is the Excel formula that verifies if a Canadian SIN is valid:
=AND(LEN(A1)=9, ISNUMBER(VALUE(A1)), MOD(SUMPRODUCT(MID(A1,{1,2,3,4,5,6,7,8,9},1)*(1+MOD(SEQUENCE(9)-1,2)*2)), 10)=0)
Breakdown of the Formula
LEN(A1)=9
: Checks if the length of the SIN in cell A1 is exactly 9 digits.ISNUMBER(VALUE(A1))
: Ensures that the input is numeric.MID(A1,{1,2,3,4,5,6,7,8,9},1)
: Extracts each digit of the SIN.SEQUENCE(9)-1
: Generates a sequence from 0 to 8 to apply the Luhn algorithm correctly.MOD(...,2)*2
: Doubles every second digit from the right, following Luhn's rule.SUMPRODUCT(...)
: Calculates the sum of the processed digits.MOD(...,10)=0
: Checks if the result is divisible by 10, confirming it is a valid SIN.
Application Scope
- The formula can be used in any Excel workbook to validate an individual's SIN based on the aforementioned criteria.
- The user must enter the SIN in cell A1 for this formula to work. Replace A1 with the relevant cell reference as necessary.
Practical Example
Consider the following SIN numbers:
SIN Number | Validation |
---|---|
123456789 | =AND(LEN(A1)=9, ISNUMBER(VALUE(A1)), MOD(SUMPRODUCT(MID(A1,{1,2,3,4,5,6,7,8,9},1)*(1+MOD(SEQUENCE(9)-1,2)*2)), 10)=0) |
123-456-789 | INVALID (not 9 digits) |
987654321 | VALID (following Luhn's) |
- Place the above formula in cell B1, and drag down to verify adjacent SIN numbers in column A.
Conclusion
This formula effectively validates Canadian Social Insurance Numbers by checking both format and checksum criteria. For further learning on data manipulation and validation using Excel, consider exploring courses on the Enterprise DNA Platform which provides comprehensive resources on data analysis techniques.
Description
Learn to validate Canadian Social Insurance Numbers (SIN) in Excel using a formula that checks format and verifies the checksum with the Luhn algorithm for accurate identification.