Solved

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

Posted on 2015-02-05
6
1,303 Views
Last Modified: 2016-09-28
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
Comment
Question by:BugHugger
6 Comments
 
LVL 23

Expert Comment

by:DanCh99
ID: 40592573
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
 
LVL 4

Expert Comment

by:scsyme
ID: 40592577
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
 
LVL 50

Assisted Solution

by:teylyn
teylyn earned 50 total points
ID: 40592652
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 4

Accepted Solution

by:
scsyme earned 450 total points
ID: 40593245
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
 

Expert Comment

by:Zee Shan
ID: 41819277
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
 
LVL 50

Expert Comment

by:teylyn
ID: 41820556
Zee Shan, please start your own question.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

758 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

21 Experts available now in Live!

Get 1:1 Help Now