Copy rows to another worksheet based on dynamic criteria

Emily20

New Member
Joined
Aug 6, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello,
I really need your help, I've been looking for a solution but can't find a case like this.

In Sheet1 I have an employee database of around 8k rows and 13 columns.
The 7th column identifies the Business Unit (25 units) and the 11th column the seniority class (8 categories: <1, 1-5, 6-10, 11-15, 16-20, 21-25, 26-30 ,>30).
For each Business Unit and for each seniority class I need to select the first X employees in the database and copy them in a new sheet. X is a number specified in a matrix in Sheet2 and is different for each intersection of business unit and class.
The final result should be a new database in Sheet3 with all records selected, one below the other.
I can't figure out how to set dynamic references, so that the macro can work when the numbers inside the matrix in Sheet2 change.

Thanks in advance for your support
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,843
Messages
6,127,240
Members
449,372
Latest member
charlottedv

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