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

IF Function Error 509 - simple comparison

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


Joined: 14 Aug 2008
Posts: 9
Location: San Diego, CA

PostPosted: Tue Jul 10, 2012 12:13 pm    Post subject: IF Function Error 509 - simple comparison Reply with quote

REF: OpenOffice 3.2, Calc

=IF(D8>120,H7+1,H7)

Cells D8 and H7, numbers

Why do I get a 509 error on the above IF function Question

What operator is missing (509 error)?
_________________
== Tecknomage ==
Computer Systems Specialist
IT Technician
Back to top
View user's profile Send private message Visit poster's website
ozzie
OOo Advocate
OOo Advocate


Joined: 29 Jul 2010
Posts: 400
Location: victoria

PostPosted: Tue Jul 10, 2012 12:48 pm    Post subject: Reply with quote

semi colons not commas
Code:
=IF(D8>120;H7+1;H7)

_________________
If your problem has been solved please add "[Solved]" to the beginning of your first post title (edit button).
Back to top
View user's profile Send private message
karolus
OOo Advocate
OOo Advocate


Joined: 22 Jun 2011
Posts: 210

PostPosted: Tue Jul 10, 2012 8:43 pm    Post subject: Reply with quote

Hallo
Code:
=H7+(D8>120)


Karo
Back to top
View user's profile Send private message
keme
Moderator
Moderator


Joined: 30 Aug 2004
Posts: 2910
Location: Egersund, Norway

PostPosted: Wed Jul 11, 2012 1:27 am    Post subject: Reply with quote

karolus wrote:
Code:
=H7+(D8>120)
ozzie wrote:
Code:
=IF(D8>120;H7+1;H7)
With current versions of OOo, the two suggestions will yield identical result.

Karolus' solution is more compact and may be more efficient, but it hides the logic and uses the undocumented "feature" of Calc assuming the logical value of TRUE to be the number one. (*)

Ozzie's suggestion preserves logic, and will work the same even if treatment of logical values changes (as may happen if you use different software, or if a software upgrade changes this behaviour).

Use Karolus' solution if file size and/or calculation time is critical, and you do not need portability (i.e. you will not be feeding that spreadsheet file to other software).
Use Ozzie's solution if you envision that others will be developing or debugging the spreadsheet (preserved logic means that the other folks will understand what you tried to do), or if you need portability.

(*) Most software use a zero value to represent FALSE.
TRUE = NOT(FALSE), and with simple handling of twos-complement signed integers (as is common with many programming languages), and the NOT() function inverting all bits, NOT(0) yields -1 (minus one) instead of the expected value of 1.

Also, type safe handling of data, as is enforced with some software and programming languages, will return an error if a logical value (TRUE/FALSE) is found where a numerical value is expected.
These issues do not apply with normal use of the spreadsheet software.
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Wed Jul 11, 2012 1:55 am    Post subject: Reply with quote

Code:
=H7+IF(D8>120;1;0)

Razz
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
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