Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 3
Default Basic Probabilities UDF Function Help

Ive written a very basic UDF function to calculate 2 probabilities given several potential variables, but I keep receiving this error message and I am entirely stumped as to what to do. This is my first time using UDF, if someone could give me some pointers, I would greatly appreciate it. I have posted what I have written below.

Function PD(a As Variant, x As Variant, z As Variant)
PD = [a(1.00-x)] + [z(1.00-a)]
End Function
Function PS(a As Variant, x As Variant, z As Variant)
PS = (a * x) + [(1.00-a)*(1.00-z)]
End Function

But when I move to an excel sheet, and insert the respective equation, including telling the function which cells it should extract the variables from for the specific problem...I receive the error messagešValue!š

Help?
  #2   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by Joe Smith03 View Post
Ive written a very basic UDF function to calculate 2 probabilities given several potential variables, but I keep receiving this error message and I am entirely stumped as to what to do. This is my first time using UDF, if someone could give me some pointers, I would greatly appreciate it. I have posted what I have written below.

Function PD(a As Variant, x As Variant, z As Variant)
PD = [a(1.00-x)] + [z(1.00-a)]
End Function
Function PS(a As Variant, x As Variant, z As Variant)
PS = (a * x) + [(1.00-a)*(1.00-z)]
End Function

But when I move to an excel sheet, and insert the respective equation, including telling the function which cells it should extract the variables from for the specific problem...I receive the error messagešValue!š

Help?


No? No one has any idea what I might be doing wrong? How disappointing. Ok.
  #3   Report Post  
Member
 
Posts: 31
Default

Sorry your query has gone so long without a response.

I believe your issue is because of the square brackets you're using in the calculation. I don't think Excel likes these.

The way to tell is to copy and paste your calculation straight into a cell in the workbook and see what the error message is - errors are suppressed when using a Function and all you get is "#NAME?" as a result if there is an error in the function.

Try using round brackets (e.g.):
PS = (a * x) + ((1 - a) * (1 - z))

Further to this, you also need to put in your multiplication signs in the PD function as Excel does not use the notation xy meaning x * y.
PD = (a * (1 - x)) + (z * (1 - a))

I hope this helps.

Last edited by tarquinious : March 3rd 11 at 05:15 PM
  #4   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by tarquinious View Post
Sorry your query has gone so long without a response.

I believe your issue is because of the square brackets you're using in the calculation. I don't think Excel likes these.

The way to tell is to copy and paste your calculation straight into a cell in the workbook and see what the error message is - errors are suppressed when using a Function and all you get is "#NAME?" as a result if there is an error in the function.

Try using round brackets (e.g.):
PS = (a * x) + ((1 - a) * (1 - z))

Further to this, you also need to put in your multiplication signs in the PD function as Excel does not use the notation xy meaning x * y.
PD = (a * (1 - x)) + (z * (1 - a))

I hope this helps.


THANKS FOR THE HELP, I APPRECIATE IT. UNFORTUNATELY IM GOING TO HAVE TO CONTINUE SEARCHING FOR MY ANSWER.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating probabilities Raul Sousa Excel Worksheet Functions 9 October 19th 09 06:44 PM
Calculating Probabilities Daisy Excel Worksheet Functions 3 March 3rd 08 09:01 PM
Question about use of Poisson probabilities Dora Smith Excel Worksheet Functions 1 February 4th 07 08:09 PM
Question about use of Poisson probabilities Dora Smith Excel Discussion (Misc queries) 4 February 4th 07 07:30 PM
Probabilities, random numbers and dice throws Galamdring Excel Worksheet Functions 2 July 21st 05 03:01 PM


All times are GMT +1. The time now is 04:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"