(Solved) – How can I extract a rows by matching two columns(one with count) in Excel VBA Macros?

(solved)-–-how-can-i-extract-a-rows-by-matching-two-columns(one-with-count)-in-excel-vba-macros?

I have an excel sheet, which looks like this:

Sheet Name: “My Hours”

Name Position Hours

a
School
10

b
School
20

c
School
30

d
college
5

e
college
4

f
college
3

Now, I want to extract rows with lowest values from the above sheet. However, how many rows and which rows are to be extracted, this decision to extract is driven by my input sheet.

Sheet “Input”

Position
How Much Number

School 2

College 1

So, in my output table, I am expecting the following output. For Eg. The following should be extracted:

Sheet “Output:”

Name Position Hours

a
School
10

b
School
20

d
college
3

In the output, I am expecting the 2 lowest rows of school and 1 lowest row for college, as I had given that in the input sheet.

How can I do this in Excel VBA Macro, after filling Inputs, to get desired outputs?

Leave a Reply

Your email address will not be published. Required fields are marked *