+ Reply to Thread
Results 1 to 6 of 6

how to use substitute function to output a formula instead of a text

  1. #1
    Registered User
    Join Date
    11-16-2009
    Location
    Hong Kong, China
    MS-Off Ver
    Excel 2007
    Posts
    3

    how to use substitute function to output a formula instead of a text

    im trying to import external data from an automatic update source, to evaluate stock performances in a live market environment. the forumla for quoting a real time stock price is:

    =PS|QUOTE!'####-HK,last'

    where #### is the stock number.

    i have in my column A the whole list of stock numbers, and want to place the according formulas in the B column. i tried using the substitute function like this:

    =substitute("=PS|QUOTE!'####-HK,last'","####",A1)

    where A1 is "0002"

    however the function can only output a string of text instead of the actual result of the formula, i.e, =PS|QUOTE!'0002-HK,last'

    any advice is appreciated.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: how to use substitute function to output a formula instead of a text

    maybe

    =INDIRECT(substitute("'PS|QUOTE'!'####-HK,last'","####",A1))

    note: your single and double quotes did not quite match up. I put spaces into the syntax below for illustration, but you need to check if this is right for your formula

    " ' sheet name ' ! ' ####-HK,last ' "
    Last edited by teylyn; 11-16-2009 at 06:19 AM.

  3. #3
    Registered User
    Join Date
    11-16-2009
    Location
    Hong Kong, China
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: how to use substitute function to output a formula instead of a text

    thanks, but invalid reference

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: how to use substitute function to output a formula instead of a text

    Well, I don't know the syntax of that function or formula you're using. It's clearly not Excel, so it might help if you could either read up on its proper usage or share some background here.

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

    Re: how to use substitute function to output a formula instead of a text

    I'm not sure INDIRECT will work here, INDIRECT is used to evaluate ranges rather than formulae, as such I suspect you will need to try & make use of old EVALUATE call via Names (or use VBA).

    Let's say your formulae are in column B, select cell B1 and then create a name called EVAL

    RefersTo: =EVALUATE("PS|QUOTE|'"&$A1&"&-HK,last'")

    Then try

    B1: =EVAL
    and copy down

    that may, may not work - given we don't have the same functionality at hand we can not test.

  6. #6
    Registered User
    Join Date
    11-16-2009
    Location
    Hong Kong, China
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: how to use substitute function to output a formula instead of a text

    still no luck but thanks

+ 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