Automatically remove rows in Excel based on values

Hello,

I have searched the forums, but can't seem to find a solution to my challange, so here goes. I need a way to automatically remove rows from an Excel sheet, based on the following:

I have a data set with several thousand rows of data on contacts:

Colomns

"Name" "Company name" "Number of employees"

"Randy" "Randy's donuts" "40"

"Sarah" "Randy's donuts" "40"

"Joe" "Joe's trucks" "25"

"Jake" "IBM" "500000"

"Adam" "IBM" "500000"

"Trevor" "IBM" "500000"

"Walter" "IBM" "500000"

"Jacob" "IBM" "500000"

"xxx" "IBM" "500000"

...

And so on...

I (probably) need a macro function, that looks at:

1. Number of employees

2. Company name

and removes contacts from rows accordingly.

For example, I have 100 contacts from IBM, but I want to remove all but 20 of them. It's for statistical purposes, so it doesn´t matter which 20 is left back. At the same time, I have two contacts from Randy's donuts, but this is a smaller company, so I need to remove all but one contact here... And so on.

The logic should be something like this:

If value "number of employees" is within range "0-30", then remove all but "x" number of rows with identical values in the field "company name"

If value "number of employees" is within range "31-100", then remove all but "x" number of rows with identical values in the field "company name"

If value "number of employees" is within range "101-250", then remove all but "x" number of rows with identical values in the field "company name"

And so on...

Hope it makes sense, and that someone can recommend me a good solution.

automatically-remove-rows-excel-base

Dear svidmar ! Could u please be a bit more clear as to what u want with those "x" data if the company name is identical even if the number of employee's greater than the specificed limit ?

Regards

Vkyvba