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?


    Recommended Productivity Tools

    Ribbon of Excel (with Kutools for Excel installed)

    300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

    Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

    •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
    •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
    •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
    •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
    •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
    •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
    •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
    •  Change the way you work now, and give you a better life immediately!

    Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

    • Increases your productivity by 50% when viewing and editing multiple documents.
    • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
    • Open and create documents in new tabs of same window, rather than in new windows.
    • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
    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.