How to find minimum value in a grouping of rows

canada

New Member
Joined
Apr 26, 2012
Messages
8
Hi,
I have a grouping and subgrouping of rows in my worksheet and I want to use the minimum value from each group and subgroup and use those values in a report on a separate worksheet using vba. Here's the situation
Emp List (Column)__________________________ Salary
- Workers
__+ Foremen
__- Juniors
____John__________________________________2000
____Max___________________________________1800
____Sandra_________________________________1925
- Management
__+ Seniors
__+ Middle
Lets say Max has the lowest salary among all the workers then I want the report to look like this
Emp Group__________ Emp____________________ Min Salary
Workers____________ Max____________________ 1800
Can I do this using vba without multiple loops at all the group levels?

Please refer to the sample sheet on the Google Docs. Since the data is confidential and also huge, I have only posted a sample here. Here's the link
https://docs.google.com/open?id=0B6y...HBEN0JZMXpKc2M
Any help will be most appreciated...Thanks a ton!
 
Hi,

link is broken.
why not using a formula to return the smallest value?
You could as well use an index match to return the name and "emp" group
formula to return smallest could be either:
In the cell of your choice:
Code:
=SMALL(B1:B100,COUNTIF($B$1:$B$100,0)+1)
Enter.
or

Code:
=MIN(IF($B$1:$B$100 <>0,$B$1:$B$100))
Ctrl + Shift + Enter, not just Enter.

Would that work?
 
Upvote 0
Well I am looking for a vba code so that I can get the results through a macro.

Any help will be most appreciated...the google docs may not show the grouping correctly...you can download the excel file fro google docs to see the exact layout.

Thanks a ton!
 
Upvote 0
I meant your file is linked to a 404 error, the file is absent.
 
Upvote 0

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