Highlight cells if number less than or equal to

This tutorial shows how to highlight cells if a number in a cell is less than or equal to a specific number by using Excel or VBA

METHOD 1. Highlight cells if number less than or equal to

EXCEL

Select data > Home tab > Style group > Click on Conditional Formatting > New Rule > Select Format only cells that contain > Select less than or equal to > > Enter number > Select color > Click OK

1. Select the range in which you want to highlight cells if the number is less than or equal to a specific number.
Note: in this example we are selecting range B3:B9.
Select range in which to highlight cells with number less than or equal to a specific number

2. Select the Home tab. Select Home tab - Excel 2016

3. Click on Conditional Formatting in the Style group.
4. Select Highlight Cells Rules.
5. Select New Rule.
Select Conditional Formatting in Style group and click New Rules

6. From a list of rule type select Format only cells that contain.
7. Select less than or equal to from the drop down menu.
8. Enter a number in the last input box. If any cell in the selected range will contain a number less than or equal to the number you have entered, they will be highlighted.
Note: in this example if any cell in the selected range contain a number less than or equal to 500 they will be highlighted.
9. Click on Format
Select Format only cells that contain, less than or equal to, enter number and click format

8. Select the Fill tab.
9. Select a color.
10. Click OK.
Note: in this example we are only applying the fill condition to the cells, in a selected range, that contain a number less then or equal to the one specified.
Select the Fill tab, select color and click OK

11. Click OK. Click OK

Highlighted cells that contain a number less than or equal to a specified number. Highlighted cells that contain a number less than or equal to a specified number

METHOD 1. Highlight cells if number less than or equal to using VBA

VBA

Sub Highlight_Less_Than_Or_Equal_To()
'declare variables
Dim ws As Worksheet
Dim ColorRng As Range
Dim ColorCell As Range
Set ws = Worksheets("Analysis")
Set ColorRng = ws.Range("B3:B9")
'highlight cells that contain a number less than or equal to the specified number
For Each ColorCell In ColorRng

If ColorCell.Value <= 500 Then
ColorCell.Interior.Color = RGB(220, 230, 241)
Else
ColorCell.Interior.ColorIndex = xlNone
End If

Next

End Sub

ADJUSTABLE PARAMETERS
Worksheet Selection: Select the worksheet which contains the data in which you want to highlight cells that contain a number less than or equal to a specific number by changing the Analysis worksheet name in the VBA code. You can also change the name of this object variable, by changing the name 'ws' in the VBA code.
Highlight Range: Select the range in which to highlight cells that contain a number less than or equal to a specific number by changing the range ("B3:B9") in the VBA code.
Highlight Color: Select the color to highlight cells that contain a number less than or equal to a specific number in the selected range by changing the RGB code (220, 230, 241) in the VBA code.
Specific Number: Select the number that you want to highlight if a cell's contains a number that is less than or equal to this number, by changing the number of 500 in the VBA code.

Explanation about how to highlight cells if number less than or equal to a specific number

EXPLANATION

EXPLANATION

This tutorial shows how to highlight cells if a number in a cell is less than or equal to a specific number by using Excel or VBA.
This tutorial provides one Excel method that can be applied to highlight cells if a number in a cell is less than or equal to a specific number in a selected range by using the Conditional Formatting. This is accomplished in 11 steps.
This tutorial provides one VBA method that can be applied to highlight cells if a number in a cell is less than or equal to a specific number. In this example the VBA code will loop through each cell in the nominated range and will highlight each cell that contains a number less than or equal to 500.

RELATED TOPICS

Related Topic Description Related Topic and Description
How to highlight cells if a number in a cell is less than a specific number
How to highlight cells that contain unique values in a selected range
How to highlight blank cells
How to highlight cells if a number in a cell is greater than or equal to a specific number
How to highlight cells that contain duplicate values in a selected range