[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
omara007
General User

Joined: 13 Jun 2009
Posts: 14

Posted: Mon Mar 15, 2010 6:34 am    Post subject: User-Definied Functions

Hi folks

How can I edit/use my own function ? for example, I want to make a simple function that returns a number if the input is a number .. else if the input is text, it returns a ZERO .. this mandates using the predefined function (ISNUMBER) as follows:

 Code: Function X(A) IF ISNUMBER(A) = TRUE THEN X=A ELSE X=0 END IF END FUNCTION

Yet, when I coded it like that it didn't work !!!!
Villeroy
Super User

Joined: 04 Oct 2004
Posts: 10081
Location: Germany

 Posted: Mon Mar 15, 2010 7:11 am    Post subject: You use the formula language in the Basic editor. Instead of =X(A1) you can much easier use the regular formula =N(A1) which returns the number in A1 or 0 if there is no number._________________Rest in peace, oooforum.org Get help on http://forum.openoffice.org
JohnV

Joined: 07 Mar 2003
Posts: 9134
Location: Lexinton, Kentucky, USA

 Posted: Mon Mar 15, 2010 7:30 am    Post subject: ISNUMBER is a Calc function. Use the Basic function ISNUMERIC.
omara007
General User

Joined: 13 Jun 2009
Posts: 14

Posted: Mon Mar 15, 2010 8:46 am    Post subject:

 Villeroy wrote: You use the formula language in the Basic editor. Instead of =X(A1) you can much easier use the regular formula =N(A1) which returns the number in A1 or 0 if there is no number.

Couldn't get what you want to say .. would you please elaborate more ?
omara007
General User

Joined: 13 Jun 2009
Posts: 14

Posted: Mon Mar 15, 2010 8:47 am    Post subject:

 JohnV wrote: ISNUMBER is a Calc function. Use the Basic function ISNUMERIC.

Thanks JohnV .. it worked this way .. but how to know these BASIC functions ?
JohnV

Joined: 07 Mar 2003
Posts: 9134
Location: Lexinton, Kentucky, USA

Posted: Mon Mar 15, 2010 2:42 pm    Post subject:

 Quote: but how to know these BASIC functions ?
That's one of the reasons forums like this exist.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum