Need help converting Inches to Gallons.

%3CLINGO-SUB%20id%3D%22lingo-sub-2800627%22%20slang%3D%22en-US%22%3ENeed%20help%20converting%20Inches%20to%20Gallons.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2800627%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI'm%20trying%20to%20code%20excel%20to%20convert%20inches%20to%20gallons%20and%20needs%20to%20be%20able%20to%20handle%20fractions%20too.%3C%2FP%3E%3CP%3EHere%20are%20the%20specs%20on%20the%20tanks%20(keep%20in%20mind%20these%20are%20horizontal%20tanks%20with%20flat%20ends).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E20%2C000%20gallon%20tank%20(I%20dont%20have%20any%20measurements%20for%20the%20tank%20other%20than%20the%20tank%20chart%20that%20says%20it%20goes%20to%201%20inch%20%3D%2025.50%20to%20120%20inches%20%3D%2019975.60%20gal.)%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E12%2C000%20gallon%20tank%26nbsp%3B%2096%22x32'%200%22%26nbsp%3B%20%26nbsp%3B1inch%20%3D%2022%20gal%20to%2096%20%3D%2012077%20gal.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20would%20be%20greatly%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2800627%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2803173%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20help%20converting%20Inches%20to%20Gallons.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2803173%22%20slang%3D%22en-US%22%3EWell.....%20the%20math%20doesn't%20seem%20to%20'add'%20up.%20by%20%22flat%20ends%22%20I%20assume%20you%20mean%20the%20tank%20has%20vertical%20walls%20so%20120%20inches%20should%20be%20120x%20larger%20than%201%20inch%20but%2025.5x120%20%3D%203060%20which%20isn't%20close%20to%2019975.6%20and%20the%20same%20goes%20for%20tank%202.%20Also%20for%20tank%202%20you%20give%20dimensions%20of%2096%22x32'%200%22%20but%20that%20doesn't%20make%20sense%20either.%20is%20that%2096%22%20dimension%20the%20height%3F%20I%20assumed%20those%20were%20length%20and%20width%20but%20that%20would%20mean%20159.6%20gal%2Fin%20but%20that%20times%2095%22%20(the%20height%20between%20those%20measurements)%20is%20over%2015%2C000%20gal.%20so%20i'll%20ignore%20the%20dimensions%20on%20tank%202%20as%20we%20don't%20have%20it%20for%20tank%201%20either.%3CBR%20%2F%3ESo%20my%20only%20guess%20is%20that%20the%201%20inch%20value%20is%20given%20to%20take%20into%20account%20irregularities%20of%20the%20tank%20bottom%20so%20all%20the%20bolts%20and%20the%20slope%20of%20the%20tank%20floor%20and%20such%20results%20in%20a%20much%20smaller%20volume%20than%20the%20rest%20of%20the%20tank%20which%20mean%20means%20every%20inch%20ABOVE%20the%201%20in%20would%20be%3CBR%20%2F%3E(19975.60-25.5)%2F119%20%3D%26gt%3B%20167.65%20gal%2Finch%20for%20tank%201%3CBR%20%2F%3E(12077%20-%2022)%2F95%20%3D%26gt%3B%20126.89%20gal%2Finch%20for%20tank%202%3CBR%20%2F%3Eof%20course%20this%20is%20some%20assumptions%20and%20guesses.%20additional%20data%20points%20could%20confirm%20or%20help%20understand%20it%20better.%20for%20example%20if%20the%20tanks%20are%20prismatic%20and%20the%20walls%20slope%20outward%20and%20then%20also%20assuming%20the%201%22%20value%20is%20a%20true%20value%20for%20that%20prism%20then%20the%20formula%20would%20be%20something%20like%20V%20%3D%20c1%20*%20h%20*%20(%201%20%2B%20c2%20*%20h%20)%20and%20with%202%20points%20and%202%20unknowns%20we%20can%20find%20c1%20and%20c2%3A%3CBR%20%2F%3Etank%201%3A%20V%20%3D%2024.315434%20*%20h%20*%20(1%20%2B%200.0487166%20*%20h)%3CBR%20%2F%3Etank%202%3A%20V%20%3D%2020.9073465%20*%20h%20*%20(1%20%2B%200.0522617%20*%20h)%3CBR%20%2F%3EAnd%20then%20finally%2C%20this%20is%20really%20not%20anything%20to%20do%20with%20Excel%20and%20more%20like%20math%20class.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2804517%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20help%20converting%20Inches%20to%20Gallons.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2804517%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIts%20the%20tank%20in%20the%20far%20right%20of%20the%20picture%2C%20the%20biggest%20one.%20Its%20120%20inches%20max%20capacity%20for%20the%2020%2C000%20gallon%20tank.%3C%2FP%3E%3CP%3EThe%2012%2C000%20gallon%20tank%20is%2096%22%20high%20and%2032'%20long.%20I%20have%20a%2096%22%20Diameter%20Guage%20chart%20for%20horizontal%20tanks.%3C%2FP%3E%3CP%3EWe%20have%20always%20done%20the%20conversion%20by%20calculator%20and%20I%20want%20the%20employees%20to%20be%20able%20to%20input%20the%20inches%20in%20excel%20and%20the%20total%20made%20for%20them.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20having%20someone%20measure%20the%2020000%20gallon%20tank%20length%20now.%20I%20hope%20this%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2804638%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20help%20converting%20Inches%20to%20Gallons.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2804638%22%20slang%3D%22en-US%22%3E20%2C000%20gallon%20tank%20is%2010ft%20high%20and%2034ft%20long.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2807535%22%20slang%3D%22en-US%22%3ERe%3A%20Need%20help%20converting%20Inches%20to%20Gallons.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2807535%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1171641%22%20target%3D%22_blank%22%3E%40NighT74%3C%2FA%3E%26nbsp%3B%20so%20my%20calculations%20differ%20from%20your%20numbers%20slightly.%26nbsp%3B%20The%20formula%20is%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DB1%2F231*IF(B3%26gt%3BB2%2F2%2CPI()*B2%5E2%2F4-ACOS(2*B3%2FB2-1)*B2%5E2%2F4-(B2%2F2-B3)*SQRT(2*B2%2F2*B3-B3%5E2)%2CACOS(1-2*B3%2FB2)*B2%5E2%2F4-(B2%2F2-B3)*SQRT(2*B2%2F2*B3-B3%5E2))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewhere%20B1%20is%20the%20Length%20in%20inches%2C%20the%20%2F231%20converts%20from%20cu.in.%20to%20gal.%20then%20the%20IF()%20statement%20checks%20if%20the%20height%20is%20%26gt%3B%201%2F2%20way%20or%20not.%3C%2FP%3E%3CP%3Eboth%20of%20the%20formulas%20are%20based%20on%20finding%20the%20volume%20of%20a%20segment%20of%20a%20circle%20which%20is%20the%20area%20of%20a%20%22slice%20of%20the%20pie%22%20minus%20the%20triangle%20above%20it.%20and%20if%20the%20height%20is%20%26gt%3B%201%2F2%20then%20'flip%20it%20upside%20down'%20and%20subtract%20that%20from%20the%20total%20area.%3C%2FP%3E%3CP%3EIn%20any%20case%20I%20attached%20the%20sheet%20and%20hope%20it%20helps%20but%20can't%20explain%20why%20my%20calculated%20volumes%20differ%20from%20your%20tables%20unless%20there%20is%20something%20else%20to%20consider.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi,

I'm trying to code excel to convert inches to gallons and needs to be able to handle fractions too.

Here are the specs on the tanks (keep in mind these are horizontal tanks with flat ends).

 

20,000 gallon tank (I dont have any measurements for the tank other than the tank chart that says it goes to 1 inch = 25.50 to 120 inches = 19975.60 gal.) 

 

12,000 gallon tank  96"x32' 0"   1inch = 22 gal to 96 = 12077 gal.

 

Any help would be greatly appreciated.

 

5 Replies
Well..... the math doesn't seem to 'add' up. by "flat ends" I assume you mean the tank has vertical walls so 120 inches should be 120x larger than 1 inch but 25.5x120 = 3060 which isn't close to 19975.6 and the same goes for tank 2. Also for tank 2 you give dimensions of 96"x32' 0" but that doesn't make sense either. is that 96" dimension the height? I assumed those were length and width but that would mean 159.6 gal/in but that times 95" (the height between those measurements) is over 15,000 gal. so i'll ignore the dimensions on tank 2 as we don't have it for tank 1 either.
So my only guess is that the 1 inch value is given to take into account irregularities of the tank bottom so all the bolts and the slope of the tank floor and such results in a much smaller volume than the rest of the tank which mean means every inch ABOVE the 1 in would be
(19975.60-25.5)/119 => 167.65 gal/inch for tank 1
(12077 - 22)/95 => 126.89 gal/inch for tank 2
of course this is some assumptions and guesses. additional data points could confirm or help understand it better. for example if the tanks are prismatic and the walls slope outward and then also assuming the 1" value is a true value for that prism then the formula would be something like V = c1 * h * ( 1 + c2 * h ) and with 2 points and 2 unknowns we can find c1 and c2:
tank 1: V = 24.315434 * h * (1 + 0.0487166 * h)
tank 2: V = 20.9073465 * h * (1 + 0.0522617 * h)
And then finally, this is really not anything to do with Excel and more like math class.

@mtarler 

 

Its the tank in the far right of the picture, the biggest one. Its 120 inches max capacity for the 20,000 gallon tank.

The 12,000 gallon tank is 96" high and 32' long. I have a 96" Diameter Guage chart for horizontal tanks.

We have always done the conversion by calculator and I want the employees to be able to input the inches in excel and the total made for them. 

I am having someone measure the 20000 gallon tank length now. I hope this helps.

20,000 gallon tank is 10ft high and 34ft long.

@NighT74  so my calculations differ from your numbers slightly.  The formula is:

=B1/231*IF(B3>B2/2,PI()*B2^2/4-ACOS(2*B3/B2-1)*B2^2/4-(B2/2-B3)*SQRT(2*B2/2*B3-B3^2),ACOS(1-2*B3/B2)*B2^2/4-(B2/2-B3)*SQRT(2*B2/2*B3-B3^2))

where B1 is the Length in inches, the /231 converts from cu.in. to gal. then the IF() statement checks if the height is > 1/2 way or not.

both of the formulas are based on finding the volume of a segment of a circle which is the area of a "slice of the pie" minus the triangle above it. and if the height is > 1/2 then 'flip it upside down' and subtract that from the total area.

In any case I attached the sheet and hope it helps but can't explain why my calculated volumes differ from your tables unless there is something else to consider.

@mtarler 

Awesome, thank you so much. It works perfectly, I could not figure the formula out on my own literally frustrating me since I am not good with math.