Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2015-02-05
6
Medium Priority
?
3,929 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
[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
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 (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE) earned 200 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Accepted Solution

by:
scsyme earned 1800 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
ID: 41820556
Zee Shan, please start your own question.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

722 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