Close Window
Free Ebook
Get Your Free Excel
Top 15 Excel Tutorials from
Instant Access!

Color Cells Based On Cell Value

I'm trying to color the cells of my spreadsheet based on the value I have inputted into the cells. The conditional formatting option does not work, because I would like to color the cells as a continuous gradient between two colors, and not as a set of discrete criteria.

In short, I would like to create a heatmap of my data, with the values in the cells still visible, but the cell colored based on the value in that cell.

Any help is much appreciated.

Free Excel Courses

Similar Excel Tutorials

How to use a SUMIF or SUMIFS function (or any conditional function or formula) on cell background color. There is n ...

How to SUM cells with certain background colors. Sections: Prepare the Data SUMIF Cells with Certain Colors SUMIFS ...

How to highlight duplicate values in a list. Also, how to arrange those values next to each other so they are easy ...

How to remove gridlines from a part of a worksheet in Excel instead of the entire worksheet or workbook. This is i ...

Helpful Excel Macros

- This macro will highlight the active cell in any excel spreadsheet with a color selected in the code. This means that a

- This macro will highlight the row and column of the active cell. This will fill the row of the active cell with a solid

- This macro will highlight the row and column of the active cell. This will fill the column and row of the active cell w

- This macro will highlight the column of the active cell. This will fill the column of the active cell with a solid back

- This macro will highlight all cells in excel which are not empty. This means that if a cell contains formulas, text, nu

Similar Topics

I have cells in a column, some colored yellow, some not. I am trying to use
the SUMIF function to sum only the cells in the range that are colored. Can
this be done? Can I enter something in the "criteria" part of the formula
that can do this?


I also tried to use the CELL function's color feature, but I couldn't get it
to work right. I don't know how to get Excel to recognize if a cell is
colored in a formula.

It might just be that I don't know what this means in Help:

"color" --> 1 if the cell is formatted in color for negative values;
otherwise returns 0 (zero).

Can anyone help?

Is it possible to change the color of text using a formula, such as an IF
statement? What I have in mind is something like this (stated simply): If
cells B9 or N9 or Z9 or AL9 are blank, do nothing, else color text in cell S4

How do I get the colors to change automatically when I use a drop down list.
Per say here is what I am trying to do

If a certain "word" is used from the drop down list I want the background of
that cell to change its color to "green." And if later I change the "word" to
another from the drop down list, it will change it's color to a specified

The drop down list that I use was created from cells that have the colors
already in the "word", but I do not know how to make the list show the colors
so it puts the word & color automatically in the drop down list to the cell
with the drop down (if that makes any sense).

If there is a way, please spell it out simple enough for me to understand,
as I don't know fully the capabilities of formulas or vba.

Is there a way I can use conditional formatting or something to change the color of the cell once I enter a value or text into that cell? For example if I currently have the A2 cell color as a gray color, and I enter information into A2 can I have it set to automatically change to no fill or any other color without having to click out of the cell, back into it, and then clicking the button?? Does that make sense??? Can someone help me?

I'm using some basic code below in an on Workbook Open event to format cells with a value less then 2 and less than 1 with a particular color.

The code works, but it really slows my worksheet down when opening. Is there better way to write this? Thanks!


Dim myRange As Range
Dim cell As Range
Set myRange = Range("V6:V50000")
 For Each cell In myRange
 If cell.Value < 2 Then cell.Font.ColorIndex = 5
 If cell.Value < 1 Then cell.Font.ColorIndex = 3

I'm trying to use conditional formatting to highlight phone calls that came in between certain hours.

The call times are in the custom format h:mm, although it could easily be changed to an Excel time format. I'm using Excel 2002. I want the cell to have a different fill color if it falls within particular time frames.

Example: If the call came in between 22:00 and 23:59 color is light green.
If the call came in between 23:59 and 08:00 the color is yellow.

Example spreadsheet is attached.

Thanks in advance.

Can you put a diagonal line in a cell and then color one part of it one color and the ther part of it another color?

I have an extensive spreadsheet with several columns and all showing borders
where each cell/column begins and ends. However there are a few cells where
the break with the next cell does not show the line.

I have highlighed the cell in question, gone to format/cell/borders and
everything looks fine. Black color + format border shows square with all
sides of square showing.

Any thoughts on how to fix these few random cells.


I am using Excel 2007 and suddenly I can no longer filter by color. The option is greyed out and so is the sort by Color option. Does anyone have any idea why this would happen?

Thanks in advance.

Hello, what I would like to do is take a portion of a sheet..... So the cells I want to mirror are in the proposal sheet cells B32 x F51. And then mirror the exact duplicate copy to another sheet. The other sheet should have those same values at A20 X G39. What I am trying to do is have a sheet that has skus, prices, and so forth and then when I add,delete, merge, color, or do anything to the cell on the "proposal creation" sheet I want it to mirror only a specific cells to another sheet that is "salesman copy" that we will print to clients. So this way ont he proposal copy a salesman can insert rows or even change the color of the cells and then have it mirror exactly the same on the "salesman copy" which is what we will print for clients. Thank you.

Hello -

I am using Excel 2007. In prior versions of excel, when copying data, if I wanted to copy visible cells only, I would select "Go To, Special, Visible Cells Only" and then copy a range a cells. The default was always set to copy everything (including hidden cells), unless I specifically selected copy visible cells only.

In 2007, the default is somehow set to always copy only visible cells. Sometimes, I want to be able to copy all cells including those hidden but cannot seem to figure out how to swith this default option. I looked under Excel Options and did not see an option there.

I don't want to have to unhide and rehide everything each time i copy. I know i could do the hiding and unhiding via VBA but would prefer not to have to.

Thanks for your suggestions.


Try this...

There are some valid datas in the cells A2 (Eg. 100), B2(Eg. 200), C2 and D2.
Data validation is used in cell K2 to limit it to a set of values.

Can we implement this formula?

A2=A3; B2=B3; C2=C3; D2=D3; K2=K3;
no change to any values.

Thanks in advance...

Greetings all,

How do I link cells so that I can make data entries into either cell? I believe this is called 2 way cell linking.

In short, I want to have a cell on one tab linked to a cell on another tab and be able to change the value of both cells by entering data either tab.

I would like to copy a small table from Word into one cell in an Excel
worksheet. The first column of the table is a list of numbers. I tried
converting the table into text with manual line breaks and tab stops to
divide columns and rows, but that didn't solve my problem.

Excel pastes the data into several rows. When I try to merge them, I
get a warning that the selection contains multiple data values, and
merging into one cell keeps the upper-left most data only.

What I tried that didn't work:
* Formatting the Excel cells as text before pasting the data.
* The various options for "Paste Special." The closest I got was
inserting the table as a Document Object, which could be a workaround,
I guess.
What I am saving for when all else fails:
* The obvious solution of copying row by row into one Excel cell.

The data in the table is information about my dad's medications. I
would like to have reference charts of how to identify the strength of
each tablet by its color and markings. I got the info from the
manufacturers' websites and entered it into tables in Word, which I
would like to copy into a more comprehensive file I am creating in
Excel. The first column of each table is the strength of the tablet,
entered as 1 mg., 2 mg., etc. The subsequent columns describe the
shape, color, and markings. There are 3 tables, each with about 4-5

Is there a way to copy each one - whether as a table or as text - into
a single Excel cell without losing data?

Many thanks.

Corporate edict.

I have a worksheet that is locked and protected now, except for cells in a certain collumn. I have named the cells in that column "MS96A".

If a user enters a date in a cell or range of cells anywhere in the column, the changed cells also need to be locked and protected (Once they enter a date, it is not allowed EVER to be changed again. Corporate requirement! *Shrug*).

What I am looking for is this. If the user selects that cell again, they will get the usual pop-up message, "The cell or chart that you are trying to change is protected..."

I think I am close, but I am getting an "End If without block If" error on the If Clause.

Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim MRange As Range
Set MRange = Range("MS96A")
' If Not Intersect(Target, MRange) Is Nothing Then For Each cell In MRange Sheets("Sheet1").Unprotect Password:="temp"
cell.Interior.ColorIndex = 3
cell.Font.Color = vbBlack
Selection.Locked = True
Selection.FormulaHidden = False
Next cell
ActiveSheet.Protect Password:="temp", _
DrawingObjects:=False, _
Contents:=True, _
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub

Afternoon all,

This is what I want to happen but I have no idea how to do it.

If C14 = "IV" THEN E14 = Locked AND F14 = Unlocked
If C14 = "RV" THEN E14 = Unlocked AND F14 = Locked
If C14 = "AJ" THEN E14 AND F14 = Unlocked

Another thing I would like to make possible is for this to work throughout cells C14:C450, E14:E450 and F14:F450

Can anyone help me out on this?


I have the following code to put data from a VBA userform into Excel

Dim Sh As Worksheet
Dim Rng As Range
Set Sh = ActiveSheet
Set Rng = Sh.Range("A65536").End(xlUp).Offset(1, 0)
With Rng
.Cells(1, 1) = Surname.Text
.Cells(1, 2) = forename.Text
.Cells(1, 3) = datein.Text
.Cells(1, 4) = origin.Text
.Cells(1, 5) = Addressee.Value
.Cells(1, 6) = usual.Value
.Cells(1, 7) = dateto.Text
.Cells(1, 8) = permission.Value
.Cells(1, 9) = dateseen.Text
.Cells(1, 10) = requestview.Value
.Cells(1, 11) = Invoice.Value
.Cells(1, 12) = notes.Text
.Cells(1, 13) = datecompleted.Text
.Cells(1, 14) = holdsend.Value
.Cells(1, 15) = fee.Text
.Cells(1, 16) = notes2.Text
.Cells(1, 17) = dateseen.Text
.Cells(1, 18) = invoicesent.Text
.Cells(1, 19) = Paid.Text
.Cells(1, 20) = Complete.Value

End With

What I want to do next is click on the surname on the speadsheet and call up the userform with the fields complete for that person. I would also like to be able to edit/update the form and update the information on the speadsheet accordingly.

Any help would be greatly appreciated!

Many thanks!

Is there a way to make a cell populate certain text based on conditions of other cells without putting the formula in the cell you want to populate. So that someone could type other text into the cell if the conditions were not met?

I am looking for assistance in having one cell in a text format equals another cell that contains a time value in hh:mm format.

For example: Cell A1 has a time format (hh:mm) value of 04:00; which is the Start Time. I would like cell D1 to have a text format value of "04:00" (result is dependant upon what is entered in A1). I would duplicate the same formulas to reflect Stop Times in other cells.

My final result is to have another cell (F1) use the Concatenate formula to have the Start and Stop time shown in one cell as "04:00 - 12:30". The times would change based on the Time formated values entered into the Start and Stop time cells.

I have researched this in the board and found many excellent ways to do the opposite, but not convert Time format to Text format. Any assistance is greatly appreciated.


I'm going over a worksheet (prepared by someone else) where I can't see the text that has been typed in the worksheet within the cells. I can see it in the editing bar, but not in the actual cell. It doesn't appear to have anything to do with the color of the text... suggestions?


I am new to using Excel and I am not very computer literate. I am looking for some help with a spreadsheet I am making. Here is the problem:

I have a column of 14 numbers in cells A1 to A14. If all of these values are less than 2%, I would like a "Pass" to display in cell B1. If any of these values are greater than 2% I would like a "Fail" to display in cell B1.

I have got a formula that works for a single cell but I can't figure out how to get it to apply to more than one cell. For example, I have entered =IF(A1<2,"Pass","Fail") in cell B1. Now if the value I enter in A1 is less than 2, it shows a "Pass", and if the value in A1 is greater than 2 it shows a "Fail" in cell B1. How can I get this to apply to all of the cells from A1 to A14?

If somebody could help me out that would be great.


Afternoon all,

I'm hoping someone can help me.

I need to be able to clear the contents of cells in column C, D, E, H if the value of column Q equals HELLO for arguments sake.

Clearing the contents of an entire row is not a problem, however when it comes to resizing rows I seem to come unstuck.

Related thread: / />
Any help would be appreciated.

I know I can put a $ sign for all references in a formula for a cell by pressing F4, but is there a quick way for doing this for multiple cells (e.g. a column) or do I have to go through all the cells individually?






I'm quite experienced Excel user. I've never come across this problem but tinkering in every conceivable way within Excel settings and the solution has eluded me.

I have added a worksheet created elsewhere (it is a form I need printing, with the data coming from 2 sheets I have created from scratch) which has pre formatted cells for Date and Client Name etc.

When I try to reference the cell in this added sheet from my 2 sheets, instead of the result, it always displays the formula, not the result.

I have tried doing it from one of my sheets to reference to this new, and that displays the result and not formula. I can't imagine why it's doing this and I've never seen it happen before.

Formatting cells, giving cells names rather than the usually adequate of reference to the Cell Number doesn't change things. I wonder if I've picked up some legacy protection from the original form but can't see anywhere in the tools etc that's obvious.

There's about 50+ cells that need referencing and I got to get this done for work.

Please help me. This is my first need to post on a Excel Forum as I've always found help or answers from other peeps or internet but this one is making me scratch my head big time.

Is there a way to use the new conditional formats (data bars, icon sets, etc) in PowerPoint? Basically, I'd like to create a table that shows icons based on data, like in Excel? I know I could paste a pre-made Excel table as a picture, but I'd like to avoid that if possible.


Related pages

reverse cell order excelfrequency tables excellitres per 100km to mpg imperialexcel calculate modeinterest accrual formulaexcel formula isna vlookuperror 91 in vbaexcel vba worksheet open eventexcel auto open macroexcel graph stacked and clusteredhow to convert euros to dollars formulahow to delete numbers in excelexcel null cellfv function in excelstop excel from roundingshs extension filevlookup simpleexcel pivot table count uniqueforgot password on excel filehow to put alphabetical order in excelfinding slope in excelconverting stone to kilosruntime error 2147467259excel weeknumexcel carriage return within celltrusted root certification authorities store locationhow to compute quartiles in excelexcel sudoku templateround robin tournament generator excelexcel geocodeexcel formula roundhow to convert xlsx to csvexcel vba unselectanimated charts in excelsla charthow to calculate timesheet hours in excelhow to find duplicates in excel 2007excel 2003 advanced filtertimecard spreadsheetflowchart examples excelpaypal reverse calculatorexcel vba do until loopcalculate my timecardfees paypal calculatorcalculate weightagefoot and inches symbolsmodallyexcel vba remove rowunlocking excelcanadian payroll deductionsroot sum square excelactivecell columnexcel calculate total hoursfind password excel protected sheetexcel formula isna vlookupavaya cms scriptscdo attachmentcubic meters formulaexport notepad to excelsubscript short cutist convert to estcan t open xls filespelling excelcorrel functionexcel vba sql connection stringhours and minutes to decimalswhat is an enhanced metafilehow to convert bytes to gbvba blank cellhotel occupancy percentage formulainsert a new worksheet in excelexponential excelstock maintenance excel sheet formatexcel countif rangeexcel chart titleexcel dragging formulasvba create word documentexcel solver vbaage from dob excelexcel print area problem