| View previous topic :: View next topic |
| Author |
Message |
timknoop Newbie

Joined: 29 Jun 2011 Posts: 3
|
Posted: Wed Jun 29, 2011 10:05 am Post subject: can OO calc make this formula? |
|
|
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 |
|
 |
Ed Super User

Joined: 28 May 2003 Posts: 1040
|
Posted: Wed Jun 29, 2011 10:18 am Post subject: |
|
|
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 |
|
 |
keme Moderator


Joined: 30 Aug 2004 Posts: 2732 Location: Egersund, Norway
|
Posted: Wed Jun 29, 2011 12:12 pm Post subject: |
|
|
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 |
|
 |
timknoop Newbie

Joined: 29 Jun 2011 Posts: 3
|
Posted: Thu Jun 30, 2011 5:38 am Post subject: can OO calc make this formula? |
|
|
| Ed, very helpful. thank you. |
|
| Back to top |
|
 |
|