+ Reply to Thread
Results 1 to 15 of 15

range.formula

  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:
    Please Login or Register  to view this content.
    Here's what shows up
    Please Login or Register  to view this content.
    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

  8. #8
    Forum Contributor Tarball's Avatar
    Join Date
    04-21-2007
    Location
    Atlanta, GA
    Posts
    166
    You really shouldn't be condescending to people who are asking for help.
    Quite the contrary, I meant no disrespect and I surely was not being condescending. I am always willing to help and glad to do it.

    Its interesting that you read a negative tone when you can also read my post with an upbeat "Of course you can!, Let us show you how!" tone....why are you so quick to think the negative?

  9. #9
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    Sorry, must be the negative conotation that I derived from your use of the word "trivial" and lack of exclamation points or smileys to give me that warm and fuzzy feeling from your post!

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Osmar, I'm sorry to tell you I can't answer your question. From your attachment, it appears you have indeed done it correctly.

    My guess is that your Spanish version of Excel uses a different name for the XLM Evaluate function. Perhaps someone else knows.

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

    Evaluate function

    Dear shg

    You helped me indeed. Now I will try to make my portuguese (brazilian) version work.

    Osmar

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

    Evaluate function

    Dear Excelenator

    I tried the workbook that you sent to me and it worked perfectly! It helped me to find the equivalent expression in Portuguese (avaliar).

    If I am not asking too much, is there a VBA property (object, method) that does the same?

    Thanks a lot.

    Osmar

  13. #13
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Osmar,

    VBA also has an Evaluate function:
    Please Login or Register  to view this content.
    Brackets are a shortcut to the function:
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    01-31-2008
    Location
    Denver
    Posts
    14

    What does the blue stuff do

    In the example way above, what does the evaluate color blue stuff do??
    This does not seem to work in Excel 2007
    Just 66 horns
    Mine goes beep beep cuz the horns are from a 66 (beetle)

  15. #15
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    It's a mistake; they were supposed to be HTML tags to make the formula blue to stand out.
    Last edited by shg; 02-29-2008 at 12:57 AM.

+ 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