Solved

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

Posted on 2015-02-05
6
1,978 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:Danny Child
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:Ingeborg Hawighorst
Ingeborg Hawighorst 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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:Ingeborg Hawighorst
ID: 41820556
Zee Shan, please start your own question.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

809 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