+ Reply to Thread
Results 1 to 15 of 15

range.formula

Hybrid View

  1. #1
    Registered User
    Join Date
    01-29-2006
    Location
    Sao Paulo - Brazil
    Posts
    17

    range.formula

    I need to solve this problem:
    In a cell named item I have a text "unit price".
    In a cell named unitprice I have a number 3.45.
    In a cell named linetext I have a text "=concatenate(item;unitprice)"
    Is it possible to use range.formula to do this using VBA? Is there another way to do this?
    I need this type of solution because the formulas in linetext will change based in other cells.

    Thanks a lot.

  2. #2
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    Of course this is possible and its pretty trivial too, simply concantenate the values of each cell or apply a formula..do whatever.

    If you have an example spreadsheet, please post it and explain where you would like to see the change.

  3. #3
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    Quote Originally Posted by Tarball
    Of course this is possible and its pretty trivial too, simply concantenate the values of each cell or apply a formula..do whatever.
    You really shouldn't be condescending to people who are asking for help.
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

  4. #4
    Registered User
    Join Date
    01-29-2006
    Location
    Sao Paulo - Brazil
    Posts
    17
    I am sorry because I have dificuties to expres myself in english.

    The problem is that the concatenated formula is just an example. The content of this cell will keep changing. Next time, maybe the content will be =unitprice * quantity.

    I would like to know if it is a way of executing a formula that is inside a cell as a text.

    Thanks for your help.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Yes, you can evaluate a text formula.
    • Select cell B1.
    • Do Insert > Name > Define, create the name Eval (or anything else you want to call it), and in RefersTo enter =Evaluate(A1)
    • Now put a text formula in some cell, say F2: =5^3. Note the leading apostrophe (or you could format the cell as text before entering). That's pretty mindless, but any valid Excel formula will work.
    • In the next cell to the right, enter =Eval
    Presto, 125!

    Here's what's entered:
      -F-- --G--
    2 =5^3 =Eval
    Here's what shows up
      -F-- -G-
    2 =5^3 125
    So wherever you enter it, =Eval will evaluate the text formula to its left. Pretty neat, huh?
    Last edited by shg; 02-29-2008 at 12:59 AM.

  6. #6
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    Ok so, if I understand this correctly, Osmar is trying to evaluate a formula in a cell that is the result of a concatenation formula of actual named ranges?

    I have attached a file with what I interpret this to be. The only problem that I am having is that the =Eval is not volatile, meaning it doesn't automatically recalcualte with the spreadsheet. Is this normal behavior?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-29-2006
    Location
    Sao Paulo - Brazil
    Posts
    17

    Evaluate formula

    Dear sgh

    I did exactly as you said. Unfortunatelly it didnīt work as you can see in the attachmente.

    Thanks a lot.

    Osmar
    Attached Files Attached Files

+ 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