Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Example: a number 1234 would sum individual dighits to a value of 10.
I thought there would be a function in Excel that would do that but can't seem to find it. I don't want write a macro with MID functions to do the summing. Is there such a function in Excel? Thank you in advance for any help |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Bob
there is no direct function, but you could use the following: =SUMPRODUCT(MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1)*1) hth Carlo On Jan 8, 9:17*am, Bob Ptacek wrote: Example: a number 1234 would sum individual dighits to a value of 10. I thought there would be a function in Excel that would do that but can't seem to find it. I don't want write a macro with MID functions to do the summing. Is there such a function in Excel? Thank you in advance for any help |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Bob
=SUMPRODUCT(--MID($A$1,ROW(INDIRECT("1:" & LEN($A$1))),1)) I forget who originally posted this, but well done! Gord Dibben MS Excel MVP On Mon, 7 Jan 2008 16:17:02 -0800, Bob Ptacek wrote: Example: a number 1234 would sum individual dighits to a value of 10. I thought there would be a function in Excel that would do that but can't seem to find it. I don't want write a macro with MID functions to do the summing. Is there such a function in Excel? Thank you in advance for any help |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Is there such a function in Excel?
Afaik, no. but simple enough to create. Public Function StringSum(str As String) As Long Dim i As Integer For i = 1 To Len(str) StringSum = StringSum + Mid(str, i, 1) Next i End Function A1: 1234 B1: =StringSum(A1) B1 should display 10 -- HTH, George "Bob Ptacek" wrote in message ... Example: a number 1234 would sum individual dighits to a value of 10. I thought there would be a function in Excel that would do that but can't seem to find it. I don't want write a macro with MID functions to do the summing. Is there such a function in Excel? Thank you in advance for any help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to return first 3 digits of a number? | Excel Worksheet Functions | |||
How to customize number to 10 digits including 2 digits after deci | Excel Worksheet Functions | |||
adding digits of a number | Excel Worksheet Functions | |||
How do I find the sum of all digits in a number? | Excel Discussion (Misc queries) | |||
help with removing digits from a number | Excel Discussion (Misc queries) |