Filter Row of desire number + 1 row below it.

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
Using Excel 2010
Hello,

There are mix numbers in the column E it is easy to filter any 1 number like if I want to select number 8, but I need bit more (if I select number 8 I want to be selected 1 row below it as well) does it is possible as shown in the example yellow highlighted row…selecting number 8 in the filter also filter 1 row below it as well.

Please advise how it could be done or suggest any VBA with input selection number.

MrExcel Question.xlsm
ABCDEFG
1
2
3
4NumTempFilter 8+Next Row
5NumTempFilter 8+Next Row
63870/710
73970/718
84070/715
9171/729
10271/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
11371/728
12471/725
13971/727
141071/727
151171/726
161271/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
171371/727
181471/7210
191571/729
201671/726
211771/725
221871/727
231971/727
242071/727
252171/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
262271/728
272371/725
282471/726
292571/726
302671/726
312771/727
322871/726
332971/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
343071/7212
353171/729
363271/727
373371/725
383471/729
393571/7210
403671/724
413771/726
423871/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
43172/737
44272/736
45372/737
46472/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
47572/737
48672/738
49772/737
50872/735
51972/736
521072/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
531172/735
541272/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
551372/736
561472/739
571572/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
581672/738
591772/736
60
61
62
63
Sheet12


Regards,
Moti
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Is there any reason why the rows in green aren't to be filtered?
Forum 27.3.xlsm
CDEF
4NumTempFilter 8+Next Row
5NumTempFilter 8+Next Row
63870/710
73970/718
84070/715
9171/729
10271/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
11371/728
12471/725
13971/727
141071/727
151171/726
161271/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
171371/727
181471/7210
191571/729
201671/726
211771/725
221871/727
231971/727
242071/727
252171/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
262271/728
272371/725
282471/726
292571/726
302671/726
312771/727
322871/726
332971/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
343071/7212
353171/729
363271/727
373371/725
383471/729
393571/7210
403671/724
413771/726
423871/728<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
43172/737
44272/736
45372/737
46472/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
47572/737
48672/738
49772/737
50872/735
51972/736
521072/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
531172/735
541272/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
551372/736
561472/739
571572/738<-----If I filter Num 8, I Need To Filter with it 1 Row below as well
581672/738
591772/736
Sheet3
 
Upvote 1
I can't think of a way to autofilter the rows but you can hide the rows that don't meet the criteria with VBA, try...

VBA Code:
Sub Moti()
    Dim i As Integer, MyNum As Integer
  
    Application.ScreenUpdating = False
  
    MyNum = Application.InputBox("Enter number", Type:=1)
  
    For i = Cells(Rows.Count, "D").End(xlUp).Row To 6 Step -1
        If Cells(i, "E").Value <> MyNum And Cells(i - 1, "E").Value <> MyNum Then _
                                   Cells(i, "E").EntireRow.Hidden = True
    Next
  
    Application.ScreenUpdating = True

End Sub
 
Last edited:
Upvote 1
Solution
I can't think of a way to filter the rows but you can hide the rows that don't meet the criteria with VBA, try...

VBA Code:
Sub Moti()
    Dim i As Integer, MyNum As Integer
  
    Application.ScreenUpdating = False
  
    MyNum = Application.InputBox("Enter number", Type:=1)
  
    For i = Cells(Rows.Count, "D").End(xlUp).Row To 6 Step -1
        If Cells(i, "E").Value <> MyNum And Cells(i - 1, "E").Value <> MyNum Then _
                                   Cells(i, "E").EntireRow.Hidden = True
    Next
  
    Application.ScreenUpdating = True

End Sub
Hello MARK858, it is a big help mean time this worked super for what I wanted. (y)
I leave it open may someone get filter idea.

I appreciate you help. Good Luck!

Kind Regards,
Moti :)
 
Upvote 0
Hello MARK858, it is a big help mean time this worked super for what I wanted. (y)
I leave it open may someone get filter idea.

I appreciate you help. Good Luck!

Kind Regards,
Moti :)
Hello MARK858, I guess it has been 49 views after you gave a solution, no more replies this makes me believed there is no filter solution.

I am using your solution it is perfect I am happy to have this VBA. Request solved. 👌

Have a nice day. Good Luck!

Regards,
Moti :)
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top