+ Reply to Thread
Results 1 to 5 of 5

Using EVALUATE to create a formula from text

  1. #1
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,546

    Using EVALUATE to create a formula from text

    I am trying to put a formula in cell B1 that changes as a user selects a function (Sum, Average, Median etc) from a drop down in cell A1. I can accomplish this with
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    , where (C10:C30) references a column of numerical data, however I wondered if there was a way to write a formula that would change the function to match the drop down such as
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    which produces a #VALUE! error? I started by wrapping this with Concatenate i.e.
    Please Login or Register  to view this content.
    which populated cell B1 with the text "=SUM(C10:C30)". I had found a thread suggested using INDIRECT wrapped around CONCATENATE to solve another problem so I tried
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    however it produced a #REF! error. I have also read about an add-in, Morefunc, that allows evaluation of text formulas from http://xcell05.free.fr/english/, however I was not able to connect to this link, and was also not sure if this would create portability issues. Is there a way to do what I am suggesting in my first sentence using portable Excel 2010 functions?

    ExampleStatsDropDown.xlsx
    Last edited by JeteMc; 12-21-2014 at 09:34 AM. Reason: Marked as solved, changed title to make documentation on the function easier to find in the future.

  2. #2
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Using INDIRECT and CONCATENATE to create a formula from text

    Can you post a copy/SAMPLE of a model that you have of this scenario -

    This will produce quicker results for you and makes it less work on the forum when trying to offer up solutions.

    If it is not sensitive data and the file is not giant feel free to share the current file, otherwise just recreate it in a sample workbook and then clarify where the variables are so we can test your current process and look for solutions that don't require plugins/downloads

    Go advanced to post files ALT+X
    -If you think you are done, Start over - ELeGault

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Using INDIRECT and CONCATENATE to create a formula from text

    there is already and excel 4 macro that you can call
    from formula tab
    insert name /new
    call it say calculate
    in refers to put
    =EVALUATE(Sheet1!$A$1&"(c1:c10)") where a1 has your drop down
    now use as =calculate
    save as xlsm tho
    Attached Files Attached Files
    Last edited by martindwilson; 12-20-2014 at 09:52 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,546

    Re: Using INDIRECT and CONCATENATE to create a formula from text

    Martin's answer is very good, it allows me not only to write a more compact code but also to insert functions into the list as needed.
    I did not know anything about the Excel 4 commands, which apparently were compiled prior to the 2001, and for which documentation is difficult to obtain.
    Glad that there are Gurus like Martin Wilson that know how to apply them.

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,546

    Re: Using INDIRECT and CONCATENATE to create a formula from text

    Martin's answer is very good, it allows me not only to write a more compact code but also to insert functions into the list as needed.
    I did not know anything about the Excel 4 commands, which apparently were compiled prior to the 2001, and for which documentation is difficult to obtain.
    Glad that there are Gurus like Martin Wilson that know how to apply them.

+ 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] Indirect concatenate match &max formula
    By bob07904 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-30-2014, 07:48 AM
  2. [SOLVED] Creating a formula using CONCATENATE or INDIRECT
    By bronsonb in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-04-2014, 12:12 PM
  3. Replies: 3
    Last Post: 11-18-2013, 06:02 AM
  4. Indirect/concatenate formula question
    By kdfja1 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-23-2013, 09:04 AM
  5. [SOLVED] Create calc formula with INDIRECT and CONCATENATE
    By FixandFoxi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-28-2012, 05:53 AM

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