Forum Discussion
Custom Sort for Weight Distribution
JKPieterse For example, if I have the following pallets to load onto a truck, I first calculate the weight. (First row.) Then I have that chart sorted to list them in ascending order, lowest to highest. (Second row.) Then I have to manually cut and paste every other cell and place them in descending order so that the heaviest pallets are in the center of the trailer and the lighter ones are in the front and back. (Last row.)
- PeterBartholomew1Sep 30, 2024Silver Contributor
Carrying on the same theme, because messy formulas like that are a distraction in your workbook, it would be possible to define your own function 'AlternatingSortλ' (say)
AlternatingSortλ =LAMBDA(p, LET( stackedSort, VSTACK(SORT(p), SORT(p, , -1)), TAKE(WRAPROWS(stackedSort, 2), , 1) ) ); Workheet formula = AlternatingSortλ(pallets)A slight change to the function would allow it to output Pallet IDs as well as their weights.
- PeterBartholomew1Sep 30, 2024Silver Contributor
Just in case a 365 user comes across this now or in the future, here is the workbook.
- KathyB1570Oct 02, 2024Copper ContributorThat's amazing, thank you! I'll try that today.