Data sort / group under some conditions

LouisLouis

New Member
Joined
May 24, 2018
Messages
1
Welcome,

I've got data as shown. My role is to sort them / group them under some conditions simultaneously:

condition no 1: for one group of 'H1' maximum 'PCS' sum is 25 / for H2 is 9 (condition no2 must be kept)
condition no 2: sum of val multiplied by 'PCS' is not greather than 9 for records with H1 and not greather than 8 for 'H2',
condition no 4: 'H1' nad 'H2' could be mixed in one grup but sum of val multiplied by 'PCS' must be not greather than 8 then,
condition no 5: if 'H1' and 'H2' are mixed in one group maximum 'PCS' sum for H1 is 12 and for H2 is 6, when imposible - do not
mix in one group



ArticlevalPCSval1
No10,11H1
No10,76H2
No10,310H1
No10,74H1
No10,29H1
No11,52H2
No226H2
No20,11H1
No20,85H1
No40,43H2
No50,75H1
No60,31H2
No60,32H2
No60,111H1
No60,61H2

<tbody>
</tbody>



Effect of doing it "on foot" (beneath)


GROUP 1
Article NovalPCSval1
No10,11H10,1
No10,310H13
No10,74H12,8
No10,29H11,8
No20,11H10,1
TOTAL257,8
GROUP 2
Article NovalPCSval1
No60,11H10,1
No20,85H14
No50,75H13,5
No60,110H11
TOTAL118,6
GROUP 3
Article NovalPCSval1
No10,76H24,2
No11,52H23
No60,61H20,6
TOTAL97,8
GROUP 4
Article NovalPCSval1
No224H28
TOTAL48
GROUP 5
Article NovalPCSval1
No222H24
No40,43H21,2
No60,31H20,3
No60,32H20,6
TOTAL86,1

<tbody>
</tbody>


Of course target is to make as low number of groups as possible but keeping A/M conditions.


If anyone could - kindly please help. Best way with VBA and custom functions.


Thanks.
LouisLouis
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,215,372
Messages
6,124,535
Members
449,169
Latest member
mm424

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