In this article, you will find two quick ways to change the background color of cells based on value in Excel 2016, 2013 and 2010. Also, you will learn how to use Excel formulas to change the color of blank cells or cells with formula errors. Show
Everyone knows that changing the background color of a single cell or a range of data in Excel is easy as clicking the Fill color button . But what if you want to change the background color of all cells with a certain value? Moreover, what if you want the background color to change automatically along with the cell value's changes? Further in this article you will find answers to these questions and learn a couple of useful tips that will help you choose the right method for each particular task.
How to change a cell's color based on value in Excel dynamicallyThe background color will change dependent on the cell's value. Task: You have a table or range of data, and you want to change the background color of cells based on cell values. Also, you want the color to change dynamically reflecting the data changes. Solution: You need to use Excel conditional formatting to highlight the values greater than X, less than Y or between X and Y. Suppose you have a list of gasoline prices in different states and you want the prices greater than USD 3.7 to be of the color red and equal to or less than USD 3.45 to be of the color green. Note: The screenshots for this example were captured in Excel 2010, however the buttons, dialogs and settings are the same or nearly the same in Excel 2016 and Excel 2013. Okay, here is what you do step-by-step:
How to permanently change a cell's color based on its current valueOnce set, the background color will not change no matter how the cell's contents might change in the future. Task: You want to color a cell based on its current value and wish the background color to remain the same even when the cell value's changes. Solution: Find all cells with a certain value or values using Excel's Find All function or Select Special Cells add-in, and then change the format of found cells using the Format Cells feature. This is one of those rare tasks that are not covered in Excel help files, forums and blogs and for which there is no straightforward solution. And this is understandable, because this task is not typical. And still, if you need to change the background color of cells statically i.e. once and forever unless you change it manually again, proceed with the following steps. Find and select all cells that meet a certain conditionThere may be several possible scenarios depending on what kind of values you are looking for. If you need to color cells with a particular value, e.g. 50, 100 or 3.4, go to the Home tab, Editing group, and click Find Select > Find…. Enter the needed values and click the Find All button. Tip: Click the Options button in the right-hand part of the Find and Replace dialog to get a number of advanced search options, such as "Match Case" and "Match entire cell content". You can use wildcard characters, such as an asterisk (*) to find any string of characters or a question mark (?) to find any single character. In our previous example, if we needed to find all gas prices between 3.7 and 3.799, we would specify the following search criteria: Now select any of the found items in the lower part of the Find and Replace dialog window by clicking on it and then press Ctrl + A to select all found entries. After that click the Close button. This is how you select all cells with a certain value(s) using the Find All function in Excel. However, what we actually need is to find all gas prices higher than 3.7 and regrettably Excel's Find and Replace dialog does not allow for such things. Luckily, there is another tool that can handle such complex conditions. The Select Special Cells add-in lets you find all values in a specified range, e.g. between -1 and 45, get the maximum / minimum value in a column, row or range, find cells by font color, fill color and much more. You click the Select by Value button on the ribbon and then specify your search criteria on the add-in's pane, in our example we are looking for values greater than 3.7. Click the Select button and in a second you will have a result like this: If you are interested to try the Select Special Cells add-in, you can download an evaluation version here. Change the background color of selected cells using "Format Cells" dialogNow that all cells with a specified value or values are selected (either by using Excel's Find and Replace or Select Special Cells add-in) what is left for you to do is force the background color of selected cells to change when a value changes. Open the Format Cells dialog by pressing Ctrl + 1 (you can also right click any of selected cells and choose "Format Cells…" from the pop-up menu, or go to Home tab > Cells group > Format > Format Cells…) and make all format changes you want. We will choose to change the background color in orange this time, just for a change :) If you want to alter the background color only without any other format changes, then you can simply click the Fill color button and choose the color to your liking. Here is the result of our format changes in Excel: Unlike the previous technique with conditional formatting, the background color set in this way will never change again without your notice, no matter how the values change. Change background color for special cells (blanks, with formula errors)Like in the previous example, you can change the background color of special cells in two ways, dynamically and statically. Use Excel formula to change background color of special cellsA cell's color will change automatically based on the cell's value. This method provides a solution that you will most likely need in 99% of cases, i.e. the background color of cells will change according to the conditions you set. We are going to use the gas prices table again as an example, but this time a couple of more states are included and some cells are empty. See how you can detect those blank cells and change their background color.
Change the background color of special cells staticallyOnce changed, the background color will remain the same, regardless of the cell values' changes. If you want to change the color of blank cells or cells with formula errors permanently, follow this way.
Just remember that formatting changes made in this way will persist even if your blank cells get filled with data or formula errors are corrected. Of course, it's hard to imagine off the top of the head why someone may want to have it this way, may be just for historical purposes :) How to get most of Excel and make challenging tasks easyAs an active user of Microsoft Excel, you know that it has plenty of features. Some of them we know and love, others are a complete mystery for an average user and various blogs, including this one, are trying to shed at least some light on them. But! There are a few very common tasks that all of us have to perform daily and Excel simply does not provide any features or tools to automate them or make an inch easier. For example, if you need to check 2 worksheets for duplicates or merge rows from single or different spreadsheets, it would take a bunch of arcane formulas or macros and still there is no guarantee you would get the accurate results. That was the reason why a team of our best Excel developers designed and created 60+ add-ins that we call the Ultimate Suite for Excel. These smart tools handle the most grueling, painstaking and error-prone tasks in Excel and ensure quickly, neatly and flawless results. Below is a short list of just some of the tasks the add-ins can help you with:
Just try these add-ins and you will see that your Excel productivity will increase up to 50%, at the very least! That's all for now. In my next article we will continue to explore this topic further and you will see how you can quickly change the background color of a row based on a cell value. Hope to see you on our blog next week! You may also be interested inHow do I change the color of a cell in Excel based on value?Re: RE: How do I make excel change the colour of a cell depending on a different cells date?. Select cell A2.. click Conditional Formatting on the Home ribbon.. click New Rule.. click Use a formula to determine which cells to format.. click into the formula box and enter the formula. ... . click the Format button and select a red color.. How do I change cell color based on value in Excel dynamically?On the Home tab, in the Styles group, click Conditional Formatting > New Rule… (see step 2 of How to dynamically change a cell color based on value for step-by-step guidance). In the "New Formatting Rule" dialog, select the option "Use a formula to determine which cells to format".
Can you use an IF statement to color a cell?Apply an If-Then rule to all cells by pressing “Ctrl-A” before assigning your rule. If you copy values from colored cells and paste them into new it new cells, the new cells acquire the color of the copied cell.
How do I change the color of a cell in Excel based on value of another cell VBA?Answers. Select column B, or the part of column B that you want to colour conditionally. ... . On the Home tab of the ribbon, click Conditional Formatting > New Rule.... Select "Use a formula to determine which cells to format".. Enter the formula =B1<>A1.. If the active cell is not in row 1, adjust the formula accordingly.. |