Solved

changing color font in Excel in if  Statement  - Excel 2010

Posted on 2013-11-14
5
492 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

752 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