At 11:21 07/11/2009 -0700, Walter Hildebrandt wrote:
I created a test spreadsheet and put 50 in cell A1, 30 in cell A2, and 40 in cell A3. Putting the formula

A1-40+IF(A1>40;STYLE("RedText");0)

in cell B1.  I then copied B1 to B2 and to B3.

The correct numbers are in B1, B2, and B3. B1 is 10, B2 is -10 and B3 is 0. *The problem is that all the B cells have red numbers.* I have probably not created the correct RedText style

No: your style is probably OK.

How do I get the minus numbers, such as the -10 in B2, to be black instead of red?

I'm not sure why your formula doesn't work: it presumably relates to how the expression is parsed and evaluated. But using STYLE(IF()) instead of IF(STYLE()) appears to solve the problem:
  =A1-40+STYLE(IF(A1>40;"RedText"))

Incidentally, you can refer to the current cell value using the CURRENT() function, so another way to do this is:
  =A1-40+STYLE(IF(CURRENT()>0;"Red"))

I trust this helps.

Brian Barker


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@openoffice.org
For additional commands, e-mail: users-h...@openoffice.org

Reply via email to