Imagine that when you are looking at a large list of numerical data, it’s useful to find largest and smallest value. Sometimes you need to find if a value is larger than a specific number. At times, the cell will be another color if the expected value is higher than a specific number. In a large data, it would be more difficult to find or calculate in excel.
Case Study 1: You can have a cell turn Green when it contains a number Greater than 200. But how do you highlight an entire row?
You can do this using Conditional Formatting. This is an Excel feature used when you want to format cells based on their content.
Our focus here is:
Learning how to highlight a particular cell based on condition using conditional formatting.
Steps to learn how to Highlight a row based on cell value.
We have a Product sale database. We want to highlight those products with a number of sales greater than 200.
- Create a table like the one in the picture above.
- This table shows electronics product’s monthly sale information of a particular shop.
- Column A contains the Product list and Column B is Showing the Number of products sold out of this month.
- Here we will highlight those product row if the number of sales is greater than 200.
- So let’s try first for the product “Mobile”.
- Select Range A2:B2
- Click Home tab
- Styles group click Conditional Formatting
- Drop-down list select New Rules.
- Now New Formatting Rule dialog box will appear
- From Select a Rule Type, list Click Use a formula to determine which cells to format
- Then in the text box named Format values where this formula is true type the code given below:
In this code, we are telling that when the value of cell B2 is greater than 200 then format the cell. Now click on Format.
- Now Format Cells dialog box will appear
- Click Fill tab and from the Background color list Select a color whatever you want
- Here we have selected green when the number of the sale will be greater than 200
- Now click OK.
- In New Formatting Rule dialog box we can see our selected Green color in Preview
- Now click OK.
Now let see in our excel sheet is the color of range A2:B2 is changed? NO! Because the number of sale is not greater than 200. Now let change the value of B2 as 250 instead of 100 and see the Magic! The color of A2:B2 is changed as green color as we were selected.
So, in this way, we can Highlight our cell based on value using some condition in New Formatting Rule.
Step 7: Now do the same process for another row. Then our table will be looked like above picture. In here we got green colored rows only for those products which are sold out more than 200. So, what about those products which are sold out less than 200.
Tips 1: We can use more than one Conditional Formatting Rules for each cell or row. So now we will do the same process for all rows but now the code will be:
And we will choose a red color for format cell.
Step 8: After applying the new rule for all rows, our table will highlight. Also those rows in where the number of sale is less than 200 as like above picture.
Add texture instead of color!
We can add Texture instead of fill color in our conditional formatting. Do the Step 2 and Step 3 again and Click Fill Effect instead of choosing any color. Then Fill Effects dialog box will appear. Now choose an effect and click OK.
After use Fill Effects, range A2:B2 will be looked like above picture. In the same way, we can change border or font instead of using color. Use another tab of Format Cells like Number, Font, and Border whatever you want.
Case Study 2: Format cells from Lowest to Highest value!
- Now we will color column B from light color to dark color based on some sales from lowest to the highest value.
- Do the Step 2 again and then in New Formatting Rule dialog box choose Format all cells based on their values.
- Choose Lowest value color and the Highest value color as like above picture.
- In this example, we have chosen a light green color for lowest sale value.
- Dark green color for highest sale value.
- Now click OK.
After that our product sale database table will be looked like above picture.
So, Now we have learned successfully, how to Highlight a Row based on a Cell value! Enjoy Excel Tips…!!