Evenly split a length into the lowest number of equal lengths

Strathe

New Member
Joined
Apr 8, 2019
Messages
3
I have a product which comes in sections. Its total length, and the sections it gets broken into, are at issue.

In some situations we will need to take an arbitrary product length (lets say 28000mm), and break it into an arbitrary number of equal sections.

I've been banging my head against it trying to solve it using GCD, but I think I am on the wrong track and I would appreciate some fresher minds having a look at it.

The rules for breaking it up are.

1) The longest any one section can be is 2800.
2) The total length will always be a multiple of 280.


The output I am looking for is the smallest number of sections the total length can be evenly broken into. From that I can get to everything else.

It's got to the frustration point where I don't even know if what I am looking for is possible!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Is this what you want?


Excel 2016 (Windows) 32 bit
A
B
C
1
TotalPiecesFormula
2
560​
1​
=INT(A2/2801)+1
3
1120​
1​
4
1680​
1​
5
2240​
1​
6
2800​
1​
7
3360​
2​
8
3920​
2​
9
4480​
2​
10
5040​
2​
11
5600​
2​
12
6160​
3​
13
6720​
3​
14
7280​
3​
15
7840​
3​
16
8400​
3​
17
8960​
4​
18
9520​
4​
19
10080​
4​
20
10640​
4​
21
11200​
4​
22
11760​
5​
23
12320​
5​
24
12880​
5​
25
13440​
5​
26
14000​
5​
27
14560​
6​
28
15120​
6​
29
15680​
6​
30
16240​
6​
31
16800​
6​
32
17360​
7​
33
17920​
7​
34
18480​
7​
35
19040​
7​
36
19600​
7​
Sheet: Sheet3
 
Upvote 0
Is this what you want?


=INT(A2/2801)+1

<tbody>
</tbody>
My gut tells me using 2801 could produce a wrong value under some circumstances (no proof... just a gut feeling). I believe the following would always work correctly...

=INT(A2/2800)+(MOD(A2,2800)>0)
 
Last edited:
Upvote 0
@Rick Rothstein - you are correct
- which only matters in practical terms if the total length to be chopped up ever exceeds approx 1.5km :)

An alternative without using MOD

=INT((A2-1)/2800)+1
 
Last edited:
Upvote 0
Ah, small corollary. There is data validation that ensures only multiples of 280 can be fed into the formula, as issues like 2801 would break a whole load of things.
 
Upvote 0
Ah, small corollary. There is data validation that ensures only multiples of 280 can be fed into the formula, as issues like 2801 would break a whole load of things.

Ah, the real reason you used 2801 twigged, don't mind me. Max total run length is 49840, so we don't have to worry about Yongle's 1.5km break point.

Thank you for your suggestions, all three variant formulas return work out for total lengths up to 28000. Over 28000 they break the max 2800 rule, but I don't think trying to break it evenly beyond that is necessary.

Thankyou!
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,690
Members
449,117
Latest member
Aaagu

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