excel IF formula help

  Boy Zone 14:48 12 Dec 2008
Locked

I'm trying to create an IF formula in excel 2003.

I want to compare two cells. If say A1 is greater than A2 then in A3 it shows the difference and displays the result number in GREEN, but if A2 is larger it displays the result in RED.

  VoG II 14:59 12 Dec 2008

The formula to give the (absolute) difference is

=ABS(A1-A2)

Then select A3, Format > Conditional Formatting, select Formula Is and enter

=A1>A2

click the Format button, choose a green font and click OK. Click the Add button, select Formula Is and enter

=A2>A1

click the Format button, choose a red font and click OK twice.

  Simsy 18:48 12 Dec 2008

what VoG™ has posted is, of course, correct, you do not HAVE to use CONDITIONAL formatting, you can just achieve it by using "ordinary" formatting for currency, or for numbers...

When you set a currency or number format you are presented with an option to have a negative value in red anyway... all you need to do is have the cell in question, (A3 in the example you give), with a green font, and have the formula =A1-A2

Obviously, if this doesn't involve money/number formats then you need to do what VoG™ has suggested!

Hope this makes sense!

Regards,

Simsy

  VoG II 20:09 12 Dec 2008

But

=ABS(A1-A2)

will always return a positive number :o)

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Fujitsu Lifebook P727 laptop review

Microsoft Paint set to die after 32 years

Mac power user tips and hidden tricks

Comment désactiver la saisie intuitive et paramétrer votre clavier ?