```
'
' This is a Very Simple Solution applicable for any Number, It Based on Simple Maths
' It so Easy, No need to Work with Loops or Goto's
'
' Any Number (Mod) 9 = Sum Of Digits
'
' 12 Mod 9 = 3
' 21 Mod 9 = 3
' 28 Mod 9 = 1 (2+8 = 1+0 = 1)
' One Validation of Any Number / 9 = 0 then Sum of Digit is 9
' 27 Mod 9 = 0
' Hence Sum of Digit is 9
'
Function SumOfDigits(DOB As Long) As Integer
'One Line Calculation
SumOfDigits = DOB Mod 9
'One more Validation
If SumOfDigits = 0 AND DOB <> 0 Then SumOfDigits = 9
'Return Result
Return SumOfDigits
End Function
```

13,045,984 members (47,643 online)

Email

Password

Sign in with