+ Reply to Thread
Results 1 to 7 of 7

Sum values in text strings across multiple cells

  1. #1
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    Sum values in text strings across multiple cells

    I'd like to use a formula to sum the values found in text strings across multiple cells.

    For example
    Cell A1 = 18K,18Mo,18Co
    Cell B1 = 2Na,2Si,2K,2Mg,2Fe,2Ca,2Al

    I would like to have a formula in C1 that will return 68 (the sum of all the values in these two strings)

    The text strings in each cell can be variable length and the numbers can be one, two or three digit numbers but will always be proceeded by a comma (except for the first occurance).

    Any help would be greatly appreciated.

    Thanks
    Last edited by bhofsetz; 01-17-2012 at 01:06 PM.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Sum values in text strings across multiple cells

    68. The total is 68 not 66
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Sum values in text strings across multiple cells

    I'm wondering if you could use some kind of inline REPLACE to change all letters and commas with a "+" sign, add a 0 to the end and evaluate that.
    So you end up with

    18+18+18+0
    then evaluate that.

    Something like EVAL(REPLACE([A...Z,],UPPER(A1),"+")&"0")

    Still thinking...

  4. #4
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Sum values in text strings across multiple cells

    check attachment with UDF function
    Attached Files Attached Files
    Last edited by tom1977; 01-16-2012 at 05:49 PM.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Sum values in text strings across multiple cells

    Hi bhofsetz,

    Check the attached Workbook, and see if that will help you. That is all I can come up with now.

    Good Luck,

    Hope it helps!
    Attached Files Attached Files
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  6. #6
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    Re: Sum values in text strings across multiple cells

    Thanks for the suggestions.

    Special-K that is a good idea but anything I was able to come up with would require nesting multiple SUBSTITUTE functions for each letter of the alphabet

    tom1977 I was hoping to avoind a UDF but I think that may be the way to to and the one you posted is very straightforward, Thanks!

    Winon your suggestion works but I was hoping for something that would automatically pluck the numeric values out of the text string and give the result rather than having to do any manual manipulation.

    Thanks again and if anyone else has further suggestions or refinement of anything so far I'd appreciate it.

  7. #7
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    Re: Sum values in text strings across multiple cells

    Thanks for the UDF tom1977. That is what I was looking for.

    My original post asked for handling items in cells A1 and B1 which tom1977's UDF worked perfectly for.

    I modified UDF so that it allows you enter a range into the UDF and it will ignore empty cells in that range

    Please Login or Register  to view this content.
    Thanks again for all the suggestions.

+ 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