greater than and less than filtering <x>

rob179994

New Member
Joined
Apr 9, 2014
Messages
8
Hi

I am having trouble filtering greater than in one range and less than in another range at the same time. If i separate them, they work separately but not at the same time. What is going on and can anyone help. Here is the code below.

Sub Filtergreater()




Sheets("FolderSort").Select
ActiveSheet.AutoFilterMode = False
Range("I4:I368").AutoFilter field:=1, Criteria1:=">" & Sheets("FrontPage").Range("E17").Value
Range("J4:J368").AutoFilter field:=1, Criteria1:="<" & Sheets("FrontPage").Range("K17").Value


End Sub



Thanks in advance.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Well the thing is, you can't manual filter for greater than or less than. You can only filter for specific values in the column.
 
Upvote 0
If you can't do it manually you won't be able to do it in VBA. It sounds like you need Advanced Filter rather than AutoFilter.
 
Upvote 0
Well the thing is, you can't manual filter for greater than or less than. You can only filter for specific values in the column.
You can't filter 2 seperate columns on an OR basis, only by AND.

What I would do is put a formula in an available column
So for example, in M4
=OR(I4>$E$17,J4<$K$17) and fill down to M368

Then filter column M for TRUE
 
Upvote 0
Yeah i like the idea of that true and false thing but the only problem is the values being used from cells E17 and K17 are on the sheet before, how do i factor this in to the formula and can this formula be written in vba code?

Thanks, much appreciated!
 
Upvote 0
You're welcome.

You can add in the sheet references as needed

=OR(I4>'FrontPage'!$E$17,J4<'FrontPage'!$K$17)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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