Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4393
  • Last Modified:

How to change the color of a cell in excel 2010 WITHOUT using conditional formatting

I have a table (see attached) that does a vlookup to find values.  If the values are above a certain number (this changes per row) I want that cell to turn red.

Conditional formatting DOES NOT WORK because the values are actually a formula, and because sometimes the values have the < symbol.

This sheet will grow infinitely, and I don't want to have to manually apply conditional formatting with every update.

See attached sheet for more notes.

Experts-Exchange-Example.xlsx

In my sheet I've split all the data out such that if there was a way to apply color via an if-then statement in the cell, what I want could be easily achieved.  However, I have no idea if such a formatting statement exists.  Ideally it would look something like:

=IF(vlookup(A$1&$B2,Conversions!:$A:D,4,false)="OVER",***Turn Red***,"")
0
BugHugger
Asked:
BugHugger
2 Solutions
 
Danny ChildIT ManagerCommented:
I don't think you can change cell formatting using a formula.  The only solution would be a macro to apply the Conditional Formatting to a named range (which could change as your sheet does).  Or, the macro could apply the formatting individually to cells, depending on the content of each one.
0
 
scsymeCommented:
A User Defined Function cannot alter the properties of cells, it can only return values to the cell it is entered into (or a number of cells if you make it an array function).
You could use a formula in an additional column to process the values in question into something that can be more consistently used by conditional formatting. Conditional formatting can be set against a range including an entire column, so if done well there should be no need to re-apply it each time.
Perhaps you can post a cleansed version of the workbook with which you are working.
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Hello,

in your spreadsheet you write: "These cells are populated by a formula, and thus won't trigger color changes when conditional formatting is used. "

That is not so. You can very well use conditional formatting on cells that contain formulas.

You provide the lookup logic in your question. You only need to apply that to a conditional formatting formula.

Select column G and make sure that the cell G1 is the active cell. Then create a conditional format with this formula:

=VLOOKUP(G$1&$B1,Conversions!$A:E,5,FALSE)="OVER"

Select a format and confirm all dialogs.

2015-02-06-13-14-33.png


cheers, teylyn
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
scsymeCommented:
Hi. Sorry, posted previously from my mobile and did not spot the attachment. I have reworked it and attached a new version. Steps outlined below.

The Conversion sheet seemed unnecessary. I have introduced a Limits sheet.
The data on all three sheets is now housed in Excel tables - this makes them easier to work with in all sorts of ways, including with expanding data. (Note that on the Final Sheet the table is less obvious because I have applied neutral formatting as the default blue-white format is not suitable)
Add four new columns to the Analytical Data (coloured purple). They are all formula based. If you paste data immediately below the table, the table will auto-expand and the calculated columns will auto-populate.
A hidden trick is the inclusion of a named range IsOverLookup which allows the conditional formatting in the Final Sheet to reference the auto-expanding columns.

I hope that this is a workable solution for you.
Experts-Exchange-Example--sol-.xlsx
0
 
Zee ShanCommented:
Hi
Kindly help me plz
i need to change color of next cell

  A B C D E F G
1
2    5 5 5
3    2 5 3
4    5 5 5
5    4 1 0
Let suppose upper mentioned values are Data and i need to change color of next cell, so what logic should i apply.

when i apply below logic, following result is shown:
=IF(OR(B2=5,C2=5,D2=5),"green", "")

  A B C D E F G
1
2    5 5 5 green
3    2 2 3
4    5 5 5 green
5    4 1 0

but i dont need this. i want green color instead of this text.

your help will highly supportive for me

Thanks
0
 
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
Zee Shan, please start your own question.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now