+ Reply to Thread
Results 1 to 6 of 6

Evaluating a string as a formula

  1. #1
    Registered User
    Join Date
    04-20-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    29

    Evaluating a string as a formula

    Hi all,

    Is there a way a string can be evaluated as a formula?
    I'm building a formula by concatening several strings but can't find a way to evaluate the formula.

    Do I need a macro or is there a simple way to eval it?

    Thanks!
    Last edited by oldchippy; 04-27-2009 at 09:11 AM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Evaluating a string as a formula

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    04-20-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Evaluating a string as a formula

    Quote Originally Posted by oldchippy View Post
    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Ok thanks.

    Here's a simplified version of my issue:

    I have a cell , say A3 that has: =CONCATENATE("=", A1, "+", A2)
    I'd like to have the sum show up there, instead, I get the concatenated string itself (and not the actual value)

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097

    Re: Evaluating a string as a formula

    Hi,

    Try

    =INDIRECT("A1")+INDIRECT("A2")

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

    Re: Evaluating a string as a formula

    Another alternative (pending complexity) could be to use Evaluate in a Defined Name...

    Consider:

    A1: 10
    B1: *
    C1: 2

    Select cell D1: Insert -> Name -> Define:

    Name: EVAL
    RefersTo: =EVALUATE(CONCATENATE(A1,B1,C1))

    D1: =EVALUATE
    result --> 20

    If B1 (operator) altered from * to / then D1: =5 ... if A1, C1 values are altered the result will alter accordingly.

    Entering =EVAL into D2 would perform a calc based on Concatenation of A2:C2

  6. #6
    Registered User
    Join Date
    04-20-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: Evaluating a string as a formula

    Quote Originally Posted by oldchippy View Post
    Hi,

    Try

    =INDIRECT("A1")+INDIRECT("A2")
    That works. Thanks 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