You make cells change color based on numbers using a powerful spreadsheet feature called Conditional Formatting. This allows you to apply specific formatting, such as background color, font color, or borders, to cells that meet certain criteria based on their numerical values.
Conditional formatting is a dynamic way to visualize data. Instead of manually coloring cells, you set rules that automatically update the formatting as the cell values change. This is incredibly useful for highlighting trends, outliers, or important data points at a glance.
There are many rules you can apply based on numbers, but let's start with a fundamental one explicitly mentioned in the provided reference: coloring cells based on whether their value is equal to a specific number.
How to Color Cells Exactly Equal to a Number
Based on the reference provided, here are the steps to highlight cells that contain a number equal to a value you specify:
- Select the range (for example,
A1:B5
) that you want to apply the conditional formatting to. This is the group of cells where you want the color change to happen based on the numbers within them. - Go to the Home tab on the ribbon.
- In the Styles group, click on Conditional Formatting.
- Hover over Highlight Cells Rules.
- Click on Equal To... in the submenu.
- In the Equal To dialog box that appears:
- In the left box, put the number you want the cells to match (e.g.,
100
). - In the right dropdown menu, assign the color and style (like Light Red Fill, Green Fill, or a Custom Format) that you want the cells to have when they match the number.
- In the left box, put the number you want the cells to match (e.g.,
- Click OK.
Now, any cell within your selected range that contains the exact number you specified will automatically change its background or font color according to your chosen format.
Example Scenario
Imagine you have a list of product stock levels in column C (C1:C50) and you want to quickly see which products have exactly 5 units left.
- Select the range
C1:C50
. - Follow the steps above:
Home > Conditional Formatting > Highlight Cells Rules > Equal To...
. - Enter
5
in the number box. - Choose a color like "Yellow Fill with Dark Yellow Text".
- Click OK.
Any cell in C1:C50
with the value 5
will now be highlighted in yellow.
Other Ways to Change Cell Color Based on Numbers
Beyond highlighting cells that are exactly equal to a number, conditional formatting offers numerous other number-based rules:
- Greater Than / Less Than: Highlight cells where the number is above or below a threshold.
- Between: Color cells with values that fall within a specific numerical range.
- Top/Bottom Rules: Automatically highlight the highest or lowest values (e.g., Top 10 Items, Bottom 20%).
- Data Bars: Create visual bars within cells proportional to their values.
- Color Scales: Apply a gradient of colors based on where a cell's value falls within the overall range of the selected data.
These rules provide flexible options to make your numerical data more intuitive and visually informative, allowing for quick identification of trends, performance, or critical points.