+ Reply to Thread
Results 1 to 11 of 11

Calculate sum of digits in a number string

Hybrid View

  1. #1
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Calculate sum of digits in a number string

    Compliments of DLL, in some distant thread:

    =A1 - FLOOR(A1 - 1, 9)
    Entia non sunt multiplicanda sine necessitate

  2. #2
    Forum Contributor
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2019
    Posts
    339

    Re: Calculate sum of digits in a number string

    Sir,I am not clear with this formula.Can you solve this problem on a work sheet ?

    Regards

    Pradeep

  3. #3
    Forum Contributor
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2019
    Posts
    339

    Re: Calculate sum of digits in a number string

    Please accept my apolozies to written again about not clear.Now the formula is working fine.I am obliged.

    Regards

    Pradeep

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

    Re: Calculate sum of digits in a number string

    Quote Originally Posted by shg View Post
    Compliments of DLL, in some distant thread:

    =A1 - FLOOR(A1 - 1, 9)
    er...FWIW... wow....

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Calculate sum of digits in a number string

    Actually, it's an example of a more general process (see http://www.mathpages.com/home/kmath020.htm and http://mathforum.org/k12/mathtips/mulliss.html ), and the simpler solution is =MOD(A1 - 1, 9) + 1.

    DLL's alternative circumvents a bug in the MOD function described at http://support.microsoft.com/kb/119083. I don't know whether it persists to later versions.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Calculate sum of digits in a number string

    Quote Originally Posted by shg View Post
    Compliments of DLL, in some distant thread:

    =A1 - FLOOR(A1 - 1, 9)
    Every now and then, the elegance of a solution makes my jaw drop. As DO said..."wow"!
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  7. #7
    Registered User
    Join Date
    10-20-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Calculate sum of digits in a number string

    Thank you,

    the formula is very helpful, is there a way to get the all 4 digit numbers with total 9?

    regards
    sam

+ 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