#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default help on UDF code

I have the following code to create a UDF to calculate reciprocals:

Function Reciprocal(a)
Reciprocal(a) = (1 / a)
End Function

The code is in a module.

I get #VALUE! errors when I try to run it. So I think this means that Excel
recognizes the UDF (otherwise it would return a #NAME error, right?)

So what's the problem here?

--
Brevity is the soul of wit.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default help on UDF code

Avoid the appearance of recursion:

Function Reciprocal(a)
Reciprocal = (1 / a)
End Function


--
Gary''s Student


"Dave F" wrote:

I have the following code to create a UDF to calculate reciprocals:

Function Reciprocal(a)
Reciprocal(a) = (1 / a)
End Function

The code is in a module.

I get #VALUE! errors when I try to run it. So I think this means that Excel
recognizes the UDF (otherwise it would return a #NAME error, right?)

So what's the problem here?

--
Brevity is the soul of wit.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,574
Default help on UDF code

OK, that works, thanks.

What do you mean by the appearance of recursion?


--
Brevity is the soul of wit.


"Gary''s Student" wrote:

Avoid the appearance of recursion:

Function Reciprocal(a)
Reciprocal = (1 / a)
End Function


--
Gary''s Student


"Dave F" wrote:

I have the following code to create a UDF to calculate reciprocals:

Function Reciprocal(a)
Reciprocal(a) = (1 / a)
End Function

The code is in a module.

I get #VALUE! errors when I try to run it. So I think this means that Excel
recognizes the UDF (otherwise it would return a #NAME error, right?)

So what's the problem here?

--
Brevity is the soul of wit.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default help on UDF code

There are some functions that are actually defined in term of themselves.
Factorials or Ackerman's function for example. See:


http://www.nist.gov/dads/HTML/ackermann.html
--
Gary's Student


"Dave F" wrote:

OK, that works, thanks.

What do you mean by the appearance of recursion?


--
Brevity is the soul of wit.


"Gary''s Student" wrote:

Avoid the appearance of recursion:

Function Reciprocal(a)
Reciprocal = (1 / a)
End Function


--
Gary''s Student


"Dave F" wrote:

I have the following code to create a UDF to calculate reciprocals:

Function Reciprocal(a)
Reciprocal(a) = (1 / a)
End Function

The code is in a module.

I get #VALUE! errors when I try to run it. So I think this means that Excel
recognizes the UDF (otherwise it would return a #NAME error, right?)

So what's the problem here?

--
Brevity is the soul of wit.

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
2 Questions John Calder New Users to Excel 18 August 24th 06 04:17 AM
code not unique find latest date Barbara Wiseman Excel Discussion (Misc queries) 3 December 11th 05 08:50 AM
VLOOKUP for Zip Code Ranges JerseyJR Excel Worksheet Functions 2 September 6th 05 06:37 PM
Conform a total to a list of results? xmaveric Excel Discussion (Misc queries) 1 August 21st 05 07:22 PM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM


All times are GMT +1. The time now is 06:41 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"