?
Solved

changing color font in Excel in if  Statement  - Excel 2010

Posted on 2013-11-14
5
Medium Priority
?
501 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 36

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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

719 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