Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to find and replace values greater than / less than a specific value in Excel?

Maybe, there are multiple data in your worksheet, now, you want to find all the cells which contain the value greater than or less than a specific number, and then replace them with another value you need at once. The normal Find and Replace feature is not applied to solve this problem, do you have any other good suggestions to deal with this task?

Find and replace values greater than / less than a specific value with VBA code

Find and replace values greater than / less than a specific value with Kutools for Excel


Find and select specific cells and then replace them with another value:

Kutools for Excel’s Select Specific Cells feature can help you find and select the specific cells, and then you can replace them with other value or do some formatting for the selected cells you need. Free Download Kutools for Excel Now.

doc replace greater than 8-8

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!



For example, I will find all the values which greater than 500, and replace them with 0.

doc replace greater than 1

The following VBA code can help you to replace the values which greater or less than a specific value at one, please do as follows:

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code: Find and replace values greater or less than a specific value

Sub FindReplace()
'Update 20150423
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    If Rng.Value > 500 Then
        Rng.Value = 0
    End If
Next
End Sub

3. Then press F5 key to run this code, and select the range data that you want to replace from the prompt box, see screenshot:

doc replace greater than 2

4. And then click OK, and you can see all the values greater than 500 have been replaced with 0.

doc replace greater than 3

Note: In the above code, you can change the following variables to your desired.

  • If Rng.Value > 500 Then
  • Rng.Value = 0

  • If you are not familiar with the code, I can talk about a handy tool- Kutools for Excel, with its Select Specific Cells feature, you can quickly select the cells that you need, and then replace them at once.

    Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

    After installing Kutools for Excel, do as following steps:

    1. Select the data range that you want to find and replace.

    2. Click Kutools > Select > Select Specific Cells, see screenshot:

    doc replace greater than 4 4

    3. In the Select Specific Cells dialog box, click Cell option under Selection type, and choose Greater than from the Specific type drop down, and enter the value you want to use in the text box besides Greater than, see screenshot:

    doc replace greater than 5

    4. Then click OK button, all the cells greater than 500 have been selected immediately, then enter the value you need to replace with, and press Ctrl + Enter keys together, all the selected values have been replaced at the same time. See screenshots:

    doc replace greater than 6  2 doc replace greater than 7

    Note: In the Select Specific Cells dialog box, you can use other criteria, such as Less than, Equals, Contains, and so on.

    Click to know more details about this Select Specific Cells feature of Kutools for Excel.

    Download and free trial Kutools for Excel Now!


    Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


    Related articles:

    How to find and replace exact match in Excel?

    How to replace text with corresponding pictures in Excel?

    How to find and replace fill color in Excel?


    Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

    • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
    • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
    • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
    • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
    • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
    • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
    • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
    • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
    • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
    kte tab 201905

    Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

    • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
    • Open and create multiple documents in new tabs of the same window, rather than in new windows.
    • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
    officetab bottom
    Say something here...
    symbols left.
    You are guest ( Sign Up? )
    or post as a guest, but your post won't be published automatically.
    Loading comment... The comment will be refreshed after 00:00.
    • To post as a guest, your comment is unpublished.
      Olesia · 5 months ago
      If only there was a way to do the same without losing formulas(
    • To post as a guest, your comment is unpublished.
      Shervin · 3 years ago
      It's really awesome!!! I love it!