+ Reply to Thread
Results 1 to 9 of 9

Sum of each cell having text string required in separate cell.

Hybrid View

  1. #1
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Sum of each cell having text string required in separate cell.

    There is a VBA function called EVALUATE that will, well, evaluate math strings like the examples you provided. Try this:

    Open the VB Editor (ALT+F11)
    Click Insert > Module
    In the new module, paste the following code:
    Public Function sum_text(r As Range)
    If r.Cells.Count > 1 Then Exit Function
    sum_text = Evaluate(r.Text)
    End Function
    Close the VB Editor window
    In cell C3, put the formula:
    Formula: copy to clipboard
    =sum_text(b3)

    It should calculate the correct value. I tested on your other examples in your test workbook, and it worked each time.

    Good luck!

  2. #2
    Registered User
    Join Date
    08-28-2013
    Location
    Pakistan
    MS-Off Ver
    Excel 2019
    Posts
    41

    Re: Sum of each cell having text string required in separate cell.

    Quote Originally Posted by Paul View Post
    There is a VBA function called EVALUATE that will, well, evaluate math strings like the examples you provided. Try this:

    Open the VB Editor (ALT+F11)
    Click Insert > Module
    In the new module, paste the following code:
    Public Function sum_text(r As Range)
    If r.Cells.Count > 1 Then Exit Function
    sum_text = Evaluate(r.Text)
    End Function
    Close the VB Editor window
    In cell C3, put the formula:
    Formula: copy to clipboard
    =sum_text(b3)

    It should calculate the correct value. I tested on your other examples in your test workbook, and it worked each time.

    Good luck!
    Thanks but I am not good with VBA, Is it possible to use functions or multiple functions in formula to resolve this?

+ 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. [SOLVED] 2 cell text lookup in text string to return data from separate column
    By Zivhodiva in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-08-2019, 03:03 PM
  2. [SOLVED] Formula or function to separate string of text in a cell to multiple columns
    By Chris McGlothen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-29-2016, 12:10 PM
  3. [SOLVED] Separate the last word of a string of text in a cell
    By ClaireH in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-07-2013, 06:33 AM
  4. Separate out a text string in one cell, and break into into individual cells
    By StephenHall in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-05-2012, 03:45 PM
  5. Separate numbers embed in a text string into a new column or cell
    By DennyT48 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-23-2012, 04:14 PM
  6. Separate a string of text from a cell
    By albardit18 in forum Excel General
    Replies: 7
    Last Post: 06-03-2011, 04:22 PM
  7. Replies: 4
    Last Post: 01-17-2011, 11:44 PM

Tags for this Thread

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