Complex filter (or macro) of CSV file

mrstoked

New Member
Joined
Jul 11, 2014
Messages
5
Hello,

Every day I have to download a CSV file, convert it to XLSX and then I have to do a complex filter and I'm wondering if there is a way to do this automatically.

The CSV files always have the same format and layout of columns and headers but the content is different.

Here's a screenshot:

domainfilter.jpg


And I need to filter these columns:

I >= 10
K >= 10
L >= 10

But really complicating things is this last filter:

K / L <= 2

Is this possible since there would be two filters on one column? Also, I'd like to save the "macro" or whatever I need to make this work separate from the file.

Thanks!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Well I can give you a simple way to separate them.

Code:
Sub HideRows()
Dim intRow as Integer
Dim intLastRow as Integer

intLastRow = ActiveSheet.UsedRange.Rows.count

For intRow = 2 to intLastRow
     If Cells(intRow, "I") < 10 OR Cells(intRow, "K") < 10 OR Cells(intRow, L) < 10 OR Cells(intRow, "K") / Cells(intRow, "L") > 2 Then
          ActiveSheet.Cells(intRow).EntireRow.Hidden = True ' You can change this line if needed
     End If
Next

End Sub

This will hide the rows that you don't want and you can copy and paste the ones that you do. Or if you want to change the noted line to delete or something similar that will work as well.

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,217,380
Messages
6,136,226
Members
450,000
Latest member
jgp19

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