| View previous topic :: View next topic |
| Author |
Message |
lord.hong Newbie

Joined: 30 Jul 2006 Posts: 3
|
Posted: Sat Aug 05, 2006 7:01 am Post subject: Highlight cell value |
|
|
Hi,
I was thinking that this job would be really easy but after three day I came to the conclusion that I can not solve this problem.
The task is easy. If one row greater than the corresponding row then a third row should change the color to red.
The pseudo code is looking:
if (A1 > B1) then
font color of C1 get red
else
font color of C1 stay black
endif
I did not find a solution with formula, conditional foramtting, or stylist.
Has anybody an advice?
Thanks,
Markus |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Sat Aug 05, 2006 8:36 am Post subject: |
|
|
if (A1 > B1) then
font color of C1 get red
else
font color of C1 stay black
endif
If C1 already has a formula returning a number:
=<existing formula>+IF(A1>B1;STYLE("myRedStyle"))
If C1 already has a formula returning a string:
=<existing formula>+IF(A1>B1;T(STYLE("myRedStyle")))
If C1 is supposed to be a formula or a constant.
Select C1:Cxxx
Notice which cell is the active cell (the bordered one getting next input)
Menu:Format>Conditional
Change "Value" to "Formula"
Formula: $A1>$B1 (replace 1 with the row of active cell)
Style: "myRedStyle"
In any case you need to define some style. The examples suggest a style named "myRedStyle". _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
DiGro Super User


Joined: 02 Jun 2004 Posts: 1208 Location: Hoorn NH, The Netherlands
|
Posted: Sat Aug 05, 2006 8:59 am Post subject: |
|
|
Well,
it is quiet obvious I think.
What do you want to display in C1 ?? If there is nothing written you can't color it.
Your formula: IF(A1>b1) might be true, but then what ??
So you have to make an addition like : IF(A1>B1;"YES";"")
in that case you have something in C1 to color red, otherwise you will have nothing to color.
Now you can use Conditional format to color C1 red if there is YES in it
Assign a new made cell-style with the fontcolor red to the cell if the formula results to YES.
EDITED: Typing while VILLEROY was sending. _________________ DiGro
Windows 7 Home Premium and OOo 3.3 NL (Dutch) |
|
| Back to top |
|
 |
|