+ Reply to Thread
Results 1 to 7 of 7

How to find the "value/sum" of numbers in a single cell

Hybrid View

  1. #1
    Registered User
    Join Date
    05-05-2008
    Posts
    45

    How to find the "value/sum" of numbers in a single cell

    If I have a cell with the number 123456789 in cell A1 I want to “add/count” the total/sum into another cell to show that (cell A1 is 1+2+3+4+5+6+7+8+9 (cell B1 is = 45

    HELP! Please...

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try this array formula. Enter with Ctrl + Shift + enter

    =SUM(VALUE(MID(A1,ROW(A1:OFFSET(A1,LEN(A1)-1,0)),1)))
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

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

    =SUM(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)+0)
    Confirmed with CTRL+SHIFT+ENTER not just ENTER.
    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.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Or non array

    =SUMPRODUCT(0+(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)))
    VBA Noob

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    problem is thats ok if only single digits
    but that could easily be 12+34+5+678+9 or any other combimation.
    but for 9 single digits
    =MID(A1,1,1)+MID(A1,2,1)+MID(A1,3,1)+MID(A1,4,1)+MID(A1,5,1)+MID(A1,6,1)+MID(A1,7,1)+MID(A1,8,1)+MID(A1,9,1)
    will work but i wonder if there's a cleaner way

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

    Red face

    ah looking upwards there is!

  7. #7
    Registered User
    Join Date
    05-05-2008
    Posts
    45
    My goodness you guys are great! Thank you so very much for the help!

+ 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