OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

User-Definied Functions

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
omara007
General User
General User


Joined: 13 Jun 2009
Posts: 14

PostPosted: Mon Mar 15, 2010 6:34 am    Post subject: User-Definied Functions Reply with quote

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 !!!!
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Mon Mar 15, 2010 7:11 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


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

PostPosted: Mon Mar 15, 2010 7:30 am    Post subject: Reply with quote

ISNUMBER is a Calc function. Use the Basic function ISNUMERIC.
Back to top
View user's profile Send private message
omara007
General User
General User


Joined: 13 Jun 2009
Posts: 14

PostPosted: Mon Mar 15, 2010 8:46 am    Post subject: Reply with quote

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 ?
Back to top
View user's profile Send private message
omara007
General User
General User


Joined: 13 Jun 2009
Posts: 14

PostPosted: Mon Mar 15, 2010 8:47 am    Post subject: Reply with quote

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 ?
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


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

PostPosted: Mon Mar 15, 2010 2:42 pm    Post subject: Reply with quote

Quote:
but how to know these BASIC functions ?
That's one of the reasons forums like this exist.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group