| View previous topic :: View next topic |
| 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 !!!! |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 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 |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8978 Location: Lexinton, Kentucky, USA
|
Posted: Mon Mar 15, 2010 7:30 am Post subject: |
|
|
| ISNUMBER is a Calc function. Use the Basic function ISNUMERIC. |
|
| Back to top |
|
 |
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 ? |
|
| Back to top |
|
 |
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 ? |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8978 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. |
|
| Back to top |
|
 |
|