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
<tbody>
</tbody>
Effect of doing it "on foot" (beneath)
<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
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
Article | val | PCS | val1 |
No1 | 0,1 | 1 | H1 |
No1 | 0,7 | 6 | H2 |
No1 | 0,3 | 10 | H1 |
No1 | 0,7 | 4 | H1 |
No1 | 0,2 | 9 | H1 |
No1 | 1,5 | 2 | H2 |
No2 | 2 | 6 | H2 |
No2 | 0,1 | 1 | H1 |
No2 | 0,8 | 5 | H1 |
No4 | 0,4 | 3 | H2 |
No5 | 0,7 | 5 | H1 |
No6 | 0,3 | 1 | H2 |
No6 | 0,3 | 2 | H2 |
No6 | 0,1 | 11 | H1 |
No6 | 0,6 | 1 | H2 |
<tbody>
</tbody>
Effect of doing it "on foot" (beneath)
GROUP 1 | ||||
Article No | val | PCS | val1 | |
No1 | 0,1 | 1 | H1 | 0,1 |
No1 | 0,3 | 10 | H1 | 3 |
No1 | 0,7 | 4 | H1 | 2,8 |
No1 | 0,2 | 9 | H1 | 1,8 |
No2 | 0,1 | 1 | H1 | 0,1 |
TOTAL | 25 | 7,8 | ||
GROUP 2 | ||||
Article No | val | PCS | val1 | |
No6 | 0,1 | 1 | H1 | 0,1 |
No2 | 0,8 | 5 | H1 | 4 |
No5 | 0,7 | 5 | H1 | 3,5 |
No6 | 0,1 | 10 | H1 | 1 |
TOTAL | 11 | 8,6 | ||
GROUP 3 | ||||
Article No | val | PCS | val1 | |
No1 | 0,7 | 6 | H2 | 4,2 |
No1 | 1,5 | 2 | H2 | 3 |
No6 | 0,6 | 1 | H2 | 0,6 |
TOTAL | 9 | 7,8 | ||
GROUP 4 | ||||
Article No | val | PCS | val1 | |
No2 | 2 | 4 | H2 | 8 |
TOTAL | 4 | 8 | ||
GROUP 5 | ||||
Article No | val | PCS | val1 | |
No2 | 2 | 2 | H2 | 4 |
No4 | 0,4 | 3 | H2 | 1,2 |
No6 | 0,3 | 1 | H2 | 0,3 |
No6 | 0,3 | 2 | H2 | 0,6 |
TOTAL | 8 | 6,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