Yes, your formula does work.  The colors are correct.

I added the following at the front of your formula and that  works.

IF(ISBLANK(A1);"Empty";IF(A1=0;"zero";

I am pushing my luck but there is another change I would like to make.  The
numbers in the A column are formatted as Numbers but they are actually
percent numbers.  Is there a way for the numbers in column B to have the %
signed included?  The B column has just the number without a % sign.

On Sat, Nov 7, 2009 at 12:10 PM, Brian Barker <b.m.bar...@btinternet.com>wrote:

> 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