+ Reply to Thread
Results 1 to 9 of 9

Adding up the digits making up a number in a cell

  1. #1
    Registered User
    Join Date
    04-16-2009
    Location
    Malmo
    MS-Off Ver
    Excel 2007
    Posts
    7

    Post Adding up the digits making up a number in a cell

    Hello,

    Is there a function in Excel (or an add-on) that would add up (sum) the digits making up a number in a cell. For example, for a cell with the number value 414 it would return in a different cell 9, or for 5411 it would return in a different cell 11 etc..

    Is there such a utility/function?!

    Thanks for help

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding up the digits making up a number in a cell

    Yes, if A1 holds string eg 5411 then to get total of digits:

    B1: =SUMPRODUCT(LEN(A1)-LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},"")),{1,2,3,4,5,6,7,8,9})

  3. #3
    Registered User
    Join Date
    04-16-2009
    Location
    Malmo
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Adding up the digits making up a number in a cell

    I am getting an error in excel using that line... Can you check it?! I am using excel 2003

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding up the digits making up a number in a cell

    The formula is fine, however, I suspect you need to translate the formula per your own regional settings
    (the formula was setup in UK region - ie comma rather than semi-colon)

    With Swedish settings, perhaps: =SUMPRODUCT(LEN(A1)-LEN(SUBSTITUTE(A1;{1\2\3\4\5\6\7\8\9};""));{1\2\3\4\5\6\7\8\9})

    (not sure if you need to translate the name of the actual functions - ie SUMPRODUCT becomes... I saw someone post a link here not long ago I will see if I can find it)
    Last edited by DonkeyOte; 04-16-2009 at 07:47 AM.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Adding up the digits making up a number in a cell

    Quote Originally Posted by DonkeyOte View Post
    ..
    (not sure if you need to translate the name of the actual functions - ie SUMPRODUCT becomes... I saw someone post a link here not long ago I will see if I can find it)
    Here's one link:

    Function Translations
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding up the digits making up a number in a cell

    Geir, martindwilson provided a nice link re: translations of functions (Edit: and NBVC above):

    http://www.piuha.fi/excel-function-n...languages.html

    So based on that I believe

    SUMPRODUCT: PRODUKTSUMMA
    LEN: LÄNGD
    SUBSTITUTE: BYT.UT

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding up the digits making up a number in a cell

    another way
    =SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1))
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Adding up the digits making up a number in a cell

    True, but Volatile.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Adding up the digits making up a number in a cell

    volatile but easier on the typing lol

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1