Solved

changing color font in Excel in if  Statement  - Excel 2010

Posted on 2013-11-14
5
486 Views
Last Modified: 2013-11-14
Experts,

Is there a way to change the color of the font in an if statement relative to if the calculation is negative or positive.

I would like to put this statement in columnd d14

If (d14-AVERAGE($d14:$G14) < 0 then  ...........

I would like to change the font  in D14 to red if negative and green if positive.
0
Comment
Question by:morinia
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39648272
I think you have yourself a circular reference.
In any case, after you solve that, use Conditional Formatting (new rule, based on formula, one for D14>-1, and one for D14 <0)
0
 
LVL 12

Assisted Solution

by:Harry Lee
Harry Lee earned 250 total points
ID: 39648569
morinia,

there is no circular reference in the formula in your question. Kimputer is absolutely wrong on that.

You would have to use Conditional Format in this situation. On D14, apply Conditional Format using New Rule. Use use a Formula to Determine which cells to format.

In the formula field, type in
=D14-AVERAGE($D14:$G14)<0

Or even more straight forward,

=D14<Average($D14:$G14)

Then, click Format button and change the font color to Red.

Take a look at the sample file.
Book1.xlsx
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 250 total points
ID: 39648723
There is also a specific option to do this in conditional formatting without using a formula.....

Select the range D14:G14

Conditional formatting > New rule > Format only values that are above or below average > Select "Above" from dropdown and select required format

Repeat the process for "Below"

regards, barry
0
 
LVL 12

Expert Comment

by:Harry Lee
ID: 39649596
Barry,

You method works somewhat. With a formula situation, the only cell that's affected is D14. With you method, the whole range D14:G14 is affected.

As stated in the question, only D14 should be affected but not the average range.
0
 
LVL 50

Expert Comment

by:barry houdini
ID: 39649635
Hello Harry,

That's true

I assumed that morinia would want to format the whole range so that each value will be coloured according to whether it's above or below average.....

...perhaps I'm wrong but morinia seemed happy with that solution :)

regards, barry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now