+ Reply to Thread
Results 1 to 6 of 6

Why does this give a syntax error? Coding a function

  1. #1
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    Why does this give a syntax error? Coding a function

    Function OTW_25PutStrike(UnderlyingPrice, Time, Interest, Dividend, Volatility, Price)


    OTW_25PutStrike = UnderlyingPrice/(EXP(Volatility*Sqr(Time)*Application.WorksheetFunction.Norm_S_Inv(((-0.25)/EXP^(-Dividend*Time))+1) -Time*(Dividend - Interest + Volatility^2/2))

    End Function

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Why does this give a syntax error? Coding a function

    Rule #X bla bla put CODE tags around your code etc.

    Having said that: You're missing a closing parenthesis.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    Re: Why does this give a syntax error? Coding a function

    Now it highlights EXP and says "argument not optional"

    What does this mean?

  4. #4
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Why does this give a syntax error? Coding a function

    Ah, didn't see the 2nd Exp there.

    You'll need to specify a parameter (i.e. Exp(a number))

    Judging by what you're trying to do there... you can either...

    1) get rid of the caret (^) sign or...
    Please Login or Register  to view this content.
    2) do a Exp(1) then raise it to the power
    Please Login or Register  to view this content.
    whichever you prefer.

  5. #5
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    Re: Why does this give a syntax error? Coding a function

    solved this! thanks for your help. this is good stuff!

  6. #6
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Why does this give a syntax error? Coding a function

    No problem at all. Please do remember to mark this thread as Solved if you can.

+ 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] Next loop, find and replace function (syntax error )
    By Grens in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2016, 08:37 PM
  2. [SOLVED] Replace function in VBA macro syntax error
    By yard2010 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2015, 06:18 PM
  3. [SOLVED] why give me error #VALUE ... i need to give me the numbers from small to big
    By mena in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-22-2015, 10:11 AM
  4. Storing a Function (Getting Syntax Error)
    By kenny.fsw in forum Access Tables & Databases
    Replies: 1
    Last Post: 11-12-2014, 05:29 PM
  5. [SOLVED] Return in function gives syntax error
    By ajaykgarg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2014, 02:05 AM
  6. [SOLVED] Please give me the VB macro coding for excel:???
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-23-2013, 06:17 AM
  7. Syntax Error calling StDev Function
    By ccolton in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2011, 05:53 PM

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