1

I am using Microsoft Excel 2013, and I want to select all cells that contain the value that is greater than a value. How do I do this ?

I have tried using Go To Specials, but it seems it is only able to select cells that have certain property such as blanks, have formulas or visible cells.

I have also found Microsoft Excel extension such as Ablebits, but it needs to pay, and I prefer the default function from excel.

Thankyou in advance.

7
  • what do you want to do with them after the selection? Are all the cells in one column, or multiple? One workaround can be to insert a helper column, where you check with a formula whether your cells fullfill the criteria, than you can filter for your cells. Nov 14, 2016 at 8:04
  • the data goes for around 30+ columns and each column goes for around 100 rows, I am going to delete all the cells that contain the value greater than a certain value, all the data are numbers
    – Charas
    Nov 14, 2016 at 8:48
  • Just to clarify. When you say delete, do you mean remove it and shift all cells below it one step up .Delete Shift:=xlUp or shift the row to the left .Delete Shift:=xlToLeft? Or do you just want to leave a blank cell? Nov 14, 2016 at 9:47
  • Delete and shift all cells up
    – Charas
    Nov 14, 2016 at 10:21
  • You can use filter then apply filter Greater than value you will see the unwanted cells, select the cells and Goto special and use visible only it will select the one you want to delete then delete rows if you want to delete the whole row
    – Sam
    Nov 14, 2016 at 10:23

1 Answer 1

1

One way is to run through all the data with a small macro.

Sub clean()
Dim r As Range, i As Integer
Set r = Range("A1:AE150")
Application.ScreenUpdating = False
Do
    i = 0
    For Each cell In r
        If cell.Value >150000 Then
            cell.Delete Shift:=xlUp
            i = i + 1
        End If
    Next cell
Loop While i > 0
Application.ScreenUpdating = True
End Sub

Warning
The actions of a macro cannot be undone. Always save before running it to prevent the loss of data.

Note that this macro will fail if there are Tables involved

7
  • Okay so I did create a new macro, edit macro and added your codes, erased 'Or whatever range you want, change r into Range("A2:AE150"), changed cell.Value > 150000, then I ran the macro, it did delete some cells that contain value >150000, however there are still a lot of cells that has value > 150000 and not deleted, am I missing something ?
    – Charas
    Nov 14, 2016 at 10:55
  • @Charas You are right. It gets confused by the shifting of cells. As say A5 is cleaned from a high value, a new high value might be shifted in to A5. And isn't checked again. Running it multiple times is one way to fix it. Or to write a better code. (sorry about that) Nov 14, 2016 at 11:09
  • Yeah I think because that the macro move sideways to the left that when a cell deleted and moved up, the cell that is moved up didn't get checked again. How do i delete the cells without moving the cells up ? is it just cell.Delete then ? I will manually delete all the blanks later on after running the macro then.
    – Charas
    Nov 14, 2016 at 11:36
  • @Charas As you can't technically delete cells without moving them, you can set the value to nothing, by changing cell.Delete Shift:=clUp to cell.Value = "". I also updated the code to repeat the process until done. So try any of these solutions. Nov 14, 2016 at 11:57
  • @Charas Sorry, found a small error in the code. Should work better now. Nov 14, 2016 at 12:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .