Solved

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

Posted on 2015-02-05
6
2,553 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
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
Independent Software Vendors: 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!

 
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

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

756 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