Gay,
Supposing the input is in A1,
in B1 enter: =SUMPRODUCT((MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))+0)
Aladin
===========
{=SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)+0)}
where A1 contains your value.
Note: This is an array formula which must be
entered using the Control+Shift+Enter key
combination. The outermost braces, {}, are not
entered by you -- they're supplied by Excel in
recognition of a properly entered array formula.
This is a UDF, to use it you have to go to Tools - Macro - Visual Basic Editor. Once there goto Insert - Module and copy - paste this:
Function SumDigits(Rang As Excel.Range) As Long
Dim i As Integer, S As Long
If Rang.Count = 1 And IsNumeric(Rang) Then
S = 0
For i = 1 To Len(Rang)
S = S + CLng(Mid(Rang, i, 1))
Next i
SumDigits = S
End If
End Function
Now, go back to excel, and use it as a regular formula...
In A1 put 28025
In A2 this formula =SumDigits(A1)
and it should result in 17.
Juan Pablo
----------------------
THANK YOU all 3 who replied to this question.
It works and my boss is a happy camper! I must
admit, I would have NEVER figured this one out
by myself. God Bless!
Gay