SUMDIGITS

Returns the sum of the digits in a cell.


Remarks

* For instructions on how to add a function to a workbook refer to the page under Inserting Functions


'Number - The number containing the digits you want to sum

Function SumDigits(Number)
Dim i As Integer

    For i = 1 To Len(Number)
      SumDigits = SumDigits + Val(Mid(Number, i, 1))
    Next i
End Function



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext