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

can OO calc make this formula?

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


Joined: 29 Jun 2011
Posts: 3

PostPosted: Wed Jun 29, 2011 10:05 am    Post subject: can OO calc make this formula? Reply with quote

i am new to Calc or any spreadsheet system.
i want to create a formula (since i cannot find it in the existing lists) that does this:

if (A1) is greater than (B1) return "over", if (B1) is greater than (A1) return "under", if equal, return "--" or "="

can this be done and how do i do it?
Back to top
View user's profile Send private message
Ed
Super User
Super User


Joined: 28 May 2003
Posts: 1041

PostPosted: Wed Jun 29, 2011 10:18 am    Post subject: Reply with quote

You could use the IF function. The structure is IF(test ; what to return if true ; what to return if false). The what to return if true and/or what to return if false can be another IF function. If you want to return text rather than a formatted number of the result of a formula, the text should be in quotation marks.

Here you could use something like
Code:
=IF(A1>B1;"over";IF(A1<B1;"under";"--"))


Hope this helps.
Back to top
View user's profile Send private message
keme
Moderator
Moderator


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

PostPosted: Wed Jun 29, 2011 12:12 pm    Post subject: Reply with quote

You could also use formatting for the display, and have numeric content in the cell.
Formula =A1-B1
Format code: "Over";"Under";"--"

The cell will then contain the actual difference, which can be used in further calculations, but will display the text indicating "direction" of the difference only.

If this is useful, also see if you can make use of the SIGN() function. (See explanation in the help system.)
Back to top
View user's profile Send private message
timknoop
Newbie
Newbie


Joined: 29 Jun 2011
Posts: 3

PostPosted: Thu Jun 30, 2011 5:38 am    Post subject: can OO calc make this formula? Reply with quote

Ed, very helpful. thank you.
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