+ Reply to Thread
Results 1 to 7 of 7

#Value! error - what's wrong with this function?

  1. #1
    Registered User
    Join Date
    12-18-2014
    Location
    Oslo, Norway
    MS-Off Ver
    Office 2007
    Posts
    27

    #Value! error - what's wrong with this function?

    I try to create my own function to calculate remaining periods on annuity mortgage. It goes like this:
    Function perioder()
    Dim PV As Double
    Dim r As Double
    Dim P As Double
    Dim perioder As Double

    perioder = Log(1 - ((PV * r) / P) ^ -1) / Log(1 + r)

    End Function
    However, when I call it in my worksheet, it only returns the #Value! error. Being new to Excel VBA programming, I can't figure out what is wrong.

    Can anybody please help me?

    Thanx a lot!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: #Value! error - what's wrong with this function?

    You haven't provided any values to the variables PV r and p

    And you don't dim perioder, that's the name of the function

    Something like
    Please Login or Register  to view this content.
    Then you call it in your worksheet like
    =perioder(10,20,30)
    or whatever the values of each veriable should be..

  3. #3
    Registered User
    Join Date
    12-18-2014
    Location
    Oslo, Norway
    MS-Off Ver
    Office 2007
    Posts
    27

    Re: #Value! error - what's wrong with this function?

    Thks for the help, but unfortunately it didn't remove the error.

    The function is called in cell F8 this way "=perioder(f5,f6,f7)", with exactly the correct arguments. The numbers I put into the function somehow seems to have a wrong format.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: #Value! error - what's wrong with this function?

    Works for me, as long as F5 F6 and F7 are all numeric values.

    Can you post a sample book?
    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  5. #5
    Registered User
    Join Date
    12-18-2014
    Location
    Oslo, Norway
    MS-Off Ver
    Office 2007
    Posts
    27

    Re: #Value! error - what's wrong with this function?

    Sure, thanks for your help.

    Let me see if I get it. Data are completely rubbish, pls. only care about the outlined cells.
    Attached Files Attached Files

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: #Value! error - what's wrong with this function?

    The LOG function requires a POSITIVE # as it's argument.

    However, with the numbers you suppllied in F5 F6 and F7,
    Then this calculation results in a negative number
    1 - ((PV * r) / P) ^ -1

    That results in
    -0.5838944

    Now LOG(-0.5838944) = Error.

  7. #7
    Registered User
    Join Date
    12-18-2014
    Location
    Oslo, Norway
    MS-Off Ver
    Office 2007
    Posts
    27

    Re: #Value! error - what's wrong with this function?

    Hmmm, now I get the #Name! error...What on earth am I doing wrong?

    Jonmo1, can you pls upload your solution to my problem...?

+ 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] Wrong Data Value Error - Please Help
    By MayBTheresHope in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-11-2014, 02:29 PM
  2. [SOLVED] LEFT function error (excelVBA) - Wrong number of arguments or invalid property assignment
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-28-2014, 07:48 AM
  3. [SOLVED] Using Offset function as the array in the PercentRank function is giving wrong result
    By Bobneil in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 08-06-2013, 09:29 PM
  4. #VALUE! Error What wrong with formula
    By JohnDear in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-2011, 01:26 PM
  5. Replies: 1
    Last Post: 02-17-2006, 12:10 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