Filtering data based on two criteria's and then deleting those rows

harvey121

New Member
Joined
Nov 27, 2018
Messages
20
Hi all,

I'm searching for a macro wherein i can filter up to 5000 rows of data based on two conditions and then delete the filtered rows.

An example of what I'm trying to do is as follows:

A sample of my data looks like this:

ColA ColB ColC
Date MarketQuantity
31-Jansweden2
25-Novus4
3-Julus5
15-Augcanada7
17-Augcanada3
17-Novcanada6
21-Augsweden8
25-Augus3
28-Augus6
28-Octus5
28-Augus1
26-Febsweden3
31-Augsweden4

<colgroup><col span="2"><col><col></colgroup><tbody>
</tbody>


Now I want to delete all those rows where the Market is Sweden and date is less than 21st March 2018, us and date less than 16th Oct 2018 canada and date less than 23rd Oct 2018.

PS: I'm getting the dates with the following format: 5/31/2018 11:23:51 PM but using short date over here.

Your help guys is really appreciated on this.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Ok then. So your dates are all true dates. Where is the data housed? Which cells? You do have headers right? What is the sheet name? Check there are no trailing spaces after the country names also. Format the dates to number with say 2 decimal places and paste the results. Finally what is the exact code you are running now?
 
Upvote 0
Hi Steve,

I had an extra row in between. Removed it and it worked perfectly.

I have one more query, As I need to shift the Markets column(Col2 over here) to column 6 adding more date in between, so what all change should I make to your previous code.

Ok then. So your dates are all true dates. Where is the data housed? Which cells? You do have headers right? What is the sheet name? Check there are no trailing spaces after the country names also. Format the dates to number with say 2 decimal places and paste the results. Finally what is the exact code you are running now?
 
Upvote 0

Forum statistics

Threads
1,214,847
Messages
6,121,911
Members
449,054
Latest member
luca142

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