If Statement To Change Cell Fillcolor

Hi All

Is it possible to use an IF statement to change a cells fills color? I am wanting to change a cells fill color if my IF statement is true, and if false then make it nofill.

Thanks for any assistance


Free Excel Help Forum

- Ask any question about Excel and have it answered in no time.

Similar Excel Tutorials

Break out of or Exit Different Types of Loops in VBA Macros in Excel
How to Exit, End, or Break out of loops in Excel. This tutorial includes breaking out of While, Do, and For loops. ...
VBA IF Statement in Excel Macros
IF statements allow you to make decisions in your Macros and VBA in Excel. An IF statement gives you the power to ...
Increment a Value Every X Number of Rows in Excel
How to increment a value, number, percent, etc. every so many rows in Excel. This tutorial teaches you how to build ...
OR Function - Check if Any Argument is True
The OR function in Excel checks if ANY argument in it evaluates to TRUE.  If anything evaluates to TRUE, then the f ...

Helpful Excel Macros

Determine a Cell's Color with this UDF - Outputs as Text or the Index Number in Excel
- This free Excel UDF allows you to output the color of a cell in text format or as that color's index number. Also note
Highlight Cells with Text or Formulas (non-empty cells)
- This macro will highlight all cells in excel which are not empty. This means that if a cell contains formulas, text, nu
Highlight Every Other Row in a Selection in Excel - Table Formatting
- This free Excel macro will highlight every other row in a selection of cells with a color that is specified within the m
Highlight the Row of the Selected Cell
- This macro will highlight the row and column of the active cell. This will fill the row of the active cell with a solid
Automatically Highlight the Active or Selected Cell
- This macro will highlight the active cell in any excel spreadsheet with a color selected in the code. This means that a

Similar Topics

Hi everyone,

I have a tedious task of highlighting and changing the fill color of certain cells. There is a specific pattern that needs to be changed everytime.

Since the color is always consistant throughout the certain cells, I would like to make 1 cell be the master cell and every other cell in my pattern copy the color fill of the master.
Therefor if I change the color of the master cell, every other cell in the pattern would automatically change itself to the same fill color.

Would there be a general solution to this with an equation or would it involve writing a macro for it.

Thanks in advance

I am using an IF statement and would like to change the cell color for one condition. Can someone help me?

(I want to change the blank cell to a new color)

Also, how do I change the font color in a cell using the IF statement.
=IF(E15*1000000000000>1000,"Red text","Green text")
I would like the "Red Text" to be red, and so forth.



heres what i want to do...

assign/fill cell b2 with a specific color
assign/fill cell d2 with a different color
assign/fill cell f2 with another

select a group of cells (b4-b7) and while selected, be able to then click cell b2 and the color of the selected cells will change to whatever color i have designated in cell b2.

i am trying to make a user friendly type of timeline spreadsheet where the user can just select a group of dates along the timeline and color them without having to look for the matching color in the color picker. i will have red, green, blue, and no fill, so if the dates change they can "erase" them with no fill.

in essance the colored cells would just be shortcut "buttons" they would not have any editable type or function to them

make sense? i just need to know the process, but a sample code (if necissary) would be appriciated

Instead of having to use the drop down menu of colors to select the fill color, I would like to have a macro that does the following:
1. First, before executing the macro, select a cell from a group of cells that already have different color fills.
2. Run the macro (click on the button assigned to the macro)
3. The macro would detect the color of the cell that had been selected and change the color of the Fill-Color command button to that color.

Now, any cell selected can be changed to the desired color by just clicking the Fill-Color command button without having to use the menu of colors.



Hi Guys,

Was wondering how i make an IF statement only change the value of the cell when the condition is met, and to leave it unchanged when the condition is false.

Thanks in advance.

Hey guys,

I am wanting to change a cell color on one sheet based on a value contained in a cell on another sheet after looking up a players name...does that make sense?? Check out the attached spreadsheet.

The cell i want to change color is D6 on the panel sheet.

I need it to look at the players name at J2, then I guess vlookup that name on the next sheet...if that player has a value in the Y column (either a 1, 2 or 3) then the cell color at D6 will change to red.

Any help would be greatly appreciatted.



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

Hey all,
I've been out of the loop for while again and I've got a little (lot) rusty ...

I want to change the 'FILL Pattern' format of a cell to 25% gray when <> NUL, and to 'NO Fill Pattern' when = NUL or zero... [The 25% specs/dots fill pattern superimposed on top of the background fill color, but not the fill color itself]...

The basic code I understand, what I need quick help with is the proceedure or code(s) to change specifically the Fill Pattern (NOT the fill color, just the pattern) and then undo the fill pattern (Again, not erase all formatting, just remove the 25% fill pattern, leaving the background fill color intact ...)

Any ideas ?


I am trying to figure out how to change the percentage of completed tasks by changing the fill color from white to an alternate color in one cell.

If I have 20 tasks and I use the basic formula to track percentages, I have to manually change the math each time a task is completed.

I would like to change the color of the cell (ie: from white to red) and have the change in color automatically perform the math to change the overall percentage.

Hi everyone,

I'm making a profit and loss statement and I would appreciate it if someone could tell me how to change the color of a cell to red for a loss, and make it stay green if a profit was made.

Any help would be greatly appreciated.


Select the desired range, say B2:D10 (with B2 active)
Click Format > Conditional Formatting
Under Condition 1, make it as
Formula is:=B2=""
Format > Pattern > Light green? > OK
Click OK at the main dialog

(Above assumes B2:D10 contains no "normal" fill color)
"Jennifer1960" wrote:
> Using selected cells only (some already contain a IF statement or data) I
> want to have cells change colour if there is no value or data in it. That is
> if data or value is then entered it would revert back to no fill.

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?

Is it possible to use an IF statement when the logical test is testing whether a cell background color is one color or another?

For example, if A1 is "blue" do this... if it is "yellow", then do this... etc.

I notice in some spreadsheets that are not mine, but they are also not protected I cannot change the color of the fill color. Why is this and is there anything I can to to change this?


I am trying to perform a vlookup function & an if statement in the same cell. if a cell from spreadsheet 1 is found on spreadsheet 2 then check on the same row if cell j2 = l2. if cell j2 = l2, if true then check and see if j2 is > k2 by more than 10, change the color of cell in column w to green.

Hi Forum,

I had some help in here previously with finding a way to change a label caption based on a date value in a corresponding textbox... Now, I'm hoping to receive some help to change the captions font color. Below is the code I'm currently using to change the label's caption:

Please Login or Register  to view this content.

What I would like is for the caption's font to appear green if it meets criteria for the "Case True" statement in the above select case. Any help? Thanks!

I have two columns. The first one (A)contains text adjacent to the colored cells the second column (B) contains cells that have different Fill colors. . I am trying to change the color of the text in the FIRST column (A) to the corresponding color in the adjacent cell in the SECOND column (B). I don't think conditional formating works well in this situation. I believe the solution would be some sort of macro.

Thanks for your help.

Ive been researching whether or not you can write an IF Statement based on the background color of a cell. I found this thread in the forum but I'm not grasping the conclusion. I havent had much luck elsewhere either.

Attached is a sample worksheet showing a master schedule with color coding. Each color represents a different person.

I would like to be able to execute a macro that will create a new page for each color in essensce giving me seperate pages for each person. This way I do not have to share each persons schedule with the other.

A few curve balls.

1. Some cells are merged to represent 1 hour.

2. Some time slots have two colors next to each other representing two meetings at the same time.

I believe I am covering everything but if not please feel free to shoot me a note.

So I'm trying to write a macro that will change the fill color of the cell in a column exceeds the value of another cell, here is what I have so far.

For Each Cell In Range("G2", Range("G65536").End(xlUp))
If Cell.Value > Sheets("Settings").Range("C2").Value Then

End If

How can I make it change the fill color of the cell in that column that exceeds the value of another cell?

Hi All,

I have a excel sheet which has conditional formatting in the cells N2 to P2 (and all cells below that), which changes their interior color to Red, Yellw and Green. (interior.color = 255, 65535 and 5287936 respectively)

Now I want to change the color of R2 and below cells (which can be done using a loop, thats no problem) depending on the colors of the cells N2 to P2 in following way.

1. 3+ Red- RED
2. 2+ Red- Amber
3. 3+ Amber- Amber
4. Rest- Green.

Can anyone put some light how I can change color of a cell depending on the color of other cells?


I would like to make an Excel template with Standardized color options.

I have been looking and I have found some sort of VBA which changes the Color Palette using VBA

This should change the color right beside black to the color I desire, a specific blue.

Sub change_palette_color
dim color_index as long
color_index = 53
ActiveWorkbook.Colors(color_index) = RGB(22, 87, 136)
End sub

however after running this, the drop down menu for colors doesnt change. Is there a different way to change the default colors when you click the drop down menu for colors (ie. Home tab, Font, Fill Color drop down options)


I have an If x = y Then statement that compares two string variables, whose values were obtained from the values of two cells in a spreadsheet. Apparently, this is a case sensitive comparison, because the statement is false when the contents of one variable include capital letters and those of the other do not, even if the letters are the same (i.e. Jim and jim)

I'd like the statement in these cases to be true, so therefore I must make it not case sensitive. Is there a way to do this?


I am looking for a way to have the background color of a cell change depending what is typed into it. For example, if "SLK" is typed in, I want it to turn green. I have about 8 possible values that would be entered that need to change it to a particular background color. Ideally, I would like to have it so that the color isn't hard coded, but it rather pulls the color from a reference cell. That way, I can change the color of a reference cell and it will change it throughout the whole worksheet.

Howdy.. I am sure this has been answered somewhere, but after four hours of surfing I can't seem to get it. So

I need to have a drop box selection change the color of the cell, but not change the value of it. The options in the drop box will be text but I need the result to be a change of color in target cell. Also need to have other options change the text color only of the cell. I am pretty new with excel, have spent alot of time tonight researching to no avail. I am running excel 2000 but have access to 2007 also. And need this to run on multiple cells. I have created the drop box cells F1-F5 using Data Validation -> List, Example of what I'm looking for

Cell A1= 16

Drop Box Option- Tardy = Change A1 to Red Background
Drop Box Option- Absent = Change A1 to Yellow Background
Drop Box Opton - Attended = Change A1 to Blue Background
Drop Box Opton - 5th = Change A1 to Blue Text
Drop Box Opton - 6th = Change A1 to Red Text

Your help is much appreciated.

I've filled in a worksheet with different theme colors. If colors are filled in by choosing a color from the theme color, the colors will change accordingly to the changed theme.

If I fill in a cell with a customized color, e.g. by pressing Ctrl+1, go to Fill tab, More colors..., Custom tab and enter a RGB value (the same RGB value as the theme color), then it will not be affected by changing the theme.

I want to convert the cells which are filled in with theme colors with customized colors so that when I change the theme, the colors will not change.

Does anyone knows how to perform this feat? Your help is much appreciated