+ Reply to Thread
Results 1 to 10 of 10

How to get a sum when text is involved within a cell?

  1. #1
    Registered User
    Join Date
    10-08-2022
    Location
    United States
    MS-Off Ver
    Google Spreadsheets
    Posts
    4

    Question How to get a sum when text is involved within a cell?

    Hi guys!

    I'm in need of some help. I'm trying to get a formula to get the sum of all those numbers within the () but I am not sure how to do so. There will be text in the cells and I'm trying to get a sum of all the numbers together (112 all together in this case)
    Help would be very much appreciated!

    Excel.png
    Last edited by Djago; 10-09-2022 at 10:08 AM. Reason: Issue solved

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,875

    Re: How to get a sum when text is involved within a cell?

    IMO, the easiest way to handle this is to go back to the data entry step and enter the text and numbers in separate cells (Test in column A and +5 in column B, for example).

    If you are required to enter the data in this way, or you have no control over the data entry/import step, then you will need to do something to separate the number from the text. Assuming the plus character is the consistent indicator of the desired number and that the number is the final part of the text string.

    1) A FIND() function to find the position of the "+" character https://support.microsoft.com/en-us/...3-d0d89b0a0628 FIND("+",A2)
    2) Get the total length of the text string using the LEN() function LEN(A2)
    3) The difference between the length and the location of the + is the number of characters that are the number, which you can use in a MID() function to extract the number as text. MID(A2,FIND(...),LEN(A2)-FIND(...))
    4) Finally, a VALUE() function (or equivalent) to convert the number stored as text to a real number =VALUE(MID(...))

    Enter that into the adjacent column (column B, assuming your picture represents columns A and B).

    5) At the bottom of the helper column, enter your SUM() function =SUM(B2:B6)

    Will something like that work for you?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    10-08-2022
    Location
    United States
    MS-Off Ver
    Google Spreadsheets
    Posts
    4

    Re: How to get a sum when text is involved within a cell?

    Thank you very much for this. I followed your steps, and it did work exactly as I wanted it to!

    I also have found another way apparently with regex extract using the following formula
    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,875

    Re: How to get a sum when text is involved within a cell?

    Interesting. I had not heard that Excel supported regular expressions in any of its built in functions. I see regexextract() in Google Sheets list of available functions, but I don't see any indication from MSFT that Excel supports this function. Can I ask, for my own edification, if this is really an Excel function, or are you using this in Google Sheets?

  5. #5
    Registered User
    Join Date
    10-08-2022
    Location
    United States
    MS-Off Ver
    Google Spreadsheets
    Posts
    4

    Re: How to get a sum when text is involved within a cell?

    Oh, apologies. I'm using Google Spreadsheets

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,498

    Re: How to get a sum when text is involved within a cell?

    The formula is valid only if you provide the sample

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,155

    Re: How to get a sum when text is involved within a cell?

    This one is a bit shorter;

    Please Login or Register  to view this content.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    23,970

    Re: How to get a sum when text is involved within a cell?

    @Djago

    Please update your profile to show Google Sheets instead of Excel. Our helpers tailor their responses based upon the operating versions you are using.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  9. #9
    Registered User
    Join Date
    10-08-2022
    Location
    United States
    MS-Off Ver
    Google Spreadsheets
    Posts
    4

    Re: How to get a sum when text is involved within a cell?

    Done. Sorry about that!

  10. #10
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,498

    Re: How to get a sum when text is involved within a cell?

    @Djago You're Welcome. Glad to help . Thank You for the feedback and rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 04-19-2016, 04:17 PM
  2. [SOLVED] Get automatic formula result when involved cell changes daily
    By DianeP in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-14-2015, 11:48 AM
  3. Replies: 1
    Last Post: 08-18-2014, 02:31 AM
  4. Using SUMIFS When Text Is Involved
    By timsoftlayer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-25-2014, 03:26 PM
  5. Thanks to the Admin's and any others involved
    By 1crazycajun in forum The Water Cooler
    Replies: 4
    Last Post: 11-21-2012, 12:51 PM
  6. IF when there is text involved..
    By iveetsa in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-01-2012, 10:46 AM
  7. Replies: 1
    Last Post: 04-15-2011, 02:14 AM

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