Formula to measure length of pipeline within specific depth brackets

WaltKerkmeer

New Member
Joined
Jan 13, 2020
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I am struggling with a formula on Excel and was hoping you could help me with this. I work for a construction company and one of the things we do is the installation of manholes and pipelines.

We get paid a rate for pipelines between 0 and 1.5 meters deep. Then there is a separate rate for pipelines between 1.51 and 3 meters deep, then 3.01 to 4.5 meters deep and so forth.

I would like Excel to calculate how many meters of pipe are in the 0-1.5m, 1.51-3m and 3.01-4.5m brackets. At the moment I’m manually calculating this for each pipeline which is time consuming. An example below:

Known values:
Manhole A: 3.4m deep
Manhole B: 2.2m deep
Pipeline length: 28 meters

This falls in the 1.51-3m and 3.01-4.5m brackets.

3.4 – 3 = 0.4

3 – 2.2 = 0.8

0.4 + 0.8 = 1.2

0.4 / 1.2 = 0.33

0.33 * 28 = 9.24

So 9.24 meters of pipe is between 3.01-4.5m deep and the remaining length of pipe will be 1.51-3m deep. As you can imagine, it gets even worse when there’s a pipeline starting at say 1.2m deep and finishing at 4.3m deep, as in that situation the result would be in 3 different depth brackets (0-1.5m, 1.51-3m and 3.01-4.5m).

If there is anyone who could produce the formula to work this out, I would be forever grateful. This will save me a tonne of time.

Thanks in advance!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Welcome to the MrExcel board!

Mathematically, this isn't a real hard problem, but we do need to figure out exactly what you're asking. Consider this (admittedly crude) diagram:

Triangle.jpg


Is this an accurate representation of your question? The length of the pipe is the bottom line for 28m. The depths are on the right. You're trying to find the 9.24 (x) value, and the equivalent value on the right. (If your 28m refers to the AB length, the logic is very similar.) Using the properties of similar triangles, we can calculate the x value. We're looking at the ABC triangle compared to the AXZ triangle. So the ratio of the right side BC to the right side XZ, is equal to the ratio of the base AC to the base AZ. i.e.

(3.4-2.2)/(3.4-3.0) = 28/x

Then solving for x we get: x = 9.33. This matches your answer, except for rounding. If this what you want, then I can come up with some Excel formulas that replicate this process for the various depths. This also ignores some issues like the diameter of the pipe, but let me know if that's important.
 
Last edited:
Upvote 0
What about this? You can test it here.

Book1
ABCDEFGHIJ
1start depth5bracket0-1.51.51-3.003.51-4.504.51-6.006,01-7,507,51-9,009,01-10,50
2end depth5.5unit price per meter10.00 $10.00 $10.00 $10.00 $10.00 $10.00 $10.00 $
3length28
4start in units3.333333333done in bracket1110.333333333000
5end in units3.666666667not done in bracket1110.666666667000
6price-3.33 $per-0.333333333meters
7PRICE280.00 $PER28meters
Sheet1
Cell Formulas
RangeFormula
G4:J5, F4:F5, D4:D5, E4:E5G4=IF(H4=0,MAX($B4-COLUMNS($C$1:F$1)+1,0),1)
B4:B5B4=B1/1.5
D6D6=SUMPRODUCT(D2:J2*D4:J4)-SUMPRODUCT(D2:J2*D5:J5)
D7D7=IFERROR(D6*(B3/F6),B3*INDEX(D2:J2,CEILING.MATH(B4)))
F6F6=SUM(D4:J4)-SUM(D5:J5)
F7F7=B3
 
Upvote 0
Hi Eric,

Thank you very much for your reply!

If I understand your representation correctly, the "pipeline length" value of 28 should be reflected under "A" to "B". The values I'm after are "A" to "X" and "X" to "B". Does this make sense? Please see below sketch of what the manholes and pipeline look like on site:

Annotation 2020-01-14 111105.png
 
Upvote 0
Manhole Name/Pipe size (mm)Calculated Line LengthMH Depth to Invert (m)0-1.5m1.51-3m3.01-4.5m4.51-6m
Upstream MHSWMH 9.5
2.2​
1st Line
300​
28.018.769.24
2nd MHSWMH 9.3
3.4​
2nd Line
375​
54.0
3rd MHSWMH 9.2
3.1​

Below the "0-1.5m", "1.51-3m" -and so forth- columns, I would like to have the length of pipe that falls within that specific depth bracket.
 
Upvote 0
OK, data is there, but it fdoes not directly conform to your data layout. First test if you accept the calculations.

Book1
ABCDEFGHIJ
1start depth1bracket0.00-1.501.51-3.003.01-4.504.51-6.006,01-7,507,51-9,009,01-10,50
2end depth3unit price per meter1.00 $2.00 $3.00 $4.00 $5.00 $6.00 $7.00 $
3length28
4start in units2length in bracket1100000
5end in units0.666666667not done in bracket0.666666667000000
6length in bracket72100000
7price7.00 $42.00 $0.00 $0.00 $0.00 $0.00 $0.00 $
8Total price49.00 $
Sheet1
Cell Formulas
RangeFormula
E4:J5, D4:D5E4=IF(F4=0,MAX($B4-COLUMNS($C$1:D$1)+1,0),1)
E6:J6, D6E6=$B$3*(E4-E5)/(SUM($D$4:$J$4)-SUM($D$5:$J$5))
E7:J7, D7E7=E6*E2
B4B4=MAX(B1,B2)/1.5
B5B5=MIN(B1,B2)/1.5
D8D8=SUM(D7:J7)
 
Upvote 0
Hi J.Ty.,

Thanks for your reply, I really appreciate it.

Your sheet seems to be doing what I want to achieve. However in all honesty I can't say I fully understand your formulas and so I cannot test them.

Say, if I had a pipeline that started at manhole A at 1.2m depth, and finished at manhole B at 4.3m depth. Would your spreadsheet give the following values:

0-1.5m: 2.71
1.51-3m: 13.55
3.01-4.5m: 11.74

If it does, then this works! Looking forward to your reply.
 
Upvote 0
Sorry forgot to add: the length of the pipeline in the above example would still be 28 meters.
 
Upvote 0
Up to rounding, it gives that. Have a look yourself: link.

J.Ty.
 
Upvote 0
I originally came up with a vertically oriented table, but I adapted it to match your layout from post 5. I changed the E1:H1 headings to just the number. But see if this works.

Book1
ABCDEFGH
1Manhole Name/Pipe size (mm)Calculated Line LengthMH Depth to Invert (m)1.534.56
2Upstream MHSWMH 9.52.2
31st Line30028018.666666679.3333333330
42nd MHSWMH 9.33.4
52nd Line3755400540
63rd MHSWMH 9.23.1
Sheet2
Cell Formulas
RangeFormula
E3:H3, E5:H5E3=MEDIAN(0,$C3-SUM($D3:D3),$C3*(E$1-$D2)/ABS($D4-$D2)-SUM($D3:D3))
 
Upvote 0

Forum statistics

Threads
1,215,379
Messages
6,124,608
Members
449,174
Latest member
ExcelfromGermany

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