+ Reply to Thread
Results 1 to 10 of 10

Find volume based on depth in relation to a fill table

  1. #1
    Registered User
    Join Date
    11-14-2014
    Location
    Bristol, England
    MS-Off Ver
    Excel
    Posts
    4

    Find volume based on depth in relation to a fill table

    Hi all,

    I have an oil tank that's of an irregular shape and I need to know the volume of oil within the tank. The company was kind enough to provide a fill table that shows the depth of the fill for certain volumes and I'm trying to use this table to figure out the volume of oil in the tank in relation to the depth. I can do this on paper by making a graph based on the fill table, plotting a line from the X axis depending on the depth reading to the graph line and plotting a line to the Y axis and there's the volume. I'm not sure how to do this in a spreadsheet, I'd really appreciate any help please?

    Many thanks!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Find volume based on depth in relation to a fill table

    You would use

    =FORECAST(Depth,B:B,A:A)

    Where Depth is the value you know, and columns A and B have the fill table, with depths in A and volumes in B, like

    =FORECAST(H7,B:B,A:A)

    Where H7 has the depth entry.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Find volume based on depth in relation to a fill table

    I would use a simple vlookup() for this. If your supplied data table looks something like this...

    A
    B
    C
    1
    150
    0
    1
    2
    8
    70
    2
    3
    77.5
    3
    4
    82.5
    4
    5
    87.5
    5
    6
    95
    6
    7
    100
    7
    8
    130
    8

    A1= depth given
    B1=VLOOKUP(A1,$B$1:$C$8,2,1) will return the volume from that table
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Find volume based on depth in relation to a fill table

    I will concur with the others that this is either a regression problem or a lookup problem.

    The Forecast() function may work, a lot depends on how "linear" the depth vs. fill curve is. For something with an "irregular shape", a straight line function may not be a good choice. There are other regression functions that can be used to obtain a variety of regression curves -- if this is the direction you want to go with the problem.

    A lookup function should be straightforward. You may want to use interpolation for values in between the table entries, or perhaps it is adequate to get the "closest" neighbor solution. A lookup solution might be the easier of the two proposed solutions.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Registered User
    Join Date
    11-14-2014
    Location
    Bristol, England
    MS-Off Ver
    Excel
    Posts
    4

    Re: Find volume based on depth in relation to a fill table

    Hello all,

    Thanks for responses!

    My problem is that the fill table supplied by the company only contains a few data points of the entire tank where I need more detail than that. Sorry if this doesn't make sense, but to illustrate my point, here's a snippet of the fill table...

    Please Login or Register  to view this content.
    If I get a depth reading of, say, 900mm, the lookup formula would return 1300 but this is obviously not the answer I'm looking for...

    From what I gather from the responses, one way forward is to expand the table to cover every possible depth reading and use VLOOKUP but I was hoping there would be a way to avoid this...

    Your time is much appreciated!

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Find volume based on depth in relation to a fill table

    From what I gather from the responses, one way forward is to expand the table to cover every possible depth reading and use VLOOKUP but I was hoping there would be a way to avoid this...
    I'm not sure that it is exactly necessary to expand the table for every possible reading and use VLOOKUP(). If a "nearest neighbor" kind of result (like you would get with a simple lookup function) is not adequate, you are going to have to consider how you want to interpolate between data points.

    If you are up to it, I might suggest Wikipedia's entry on interpolation: http://en.wikipedia.org/wiki/Interpolation

    By far the simplest interpolation algorithm to implement (beyond "nearest neighbor" type algorithms) is a linear interpolation. Unfortunately, Excel (unlike Quattro Pro and perhaps other spreadsheet applications) does not provide a built in linear interpolation function. It is relatively easy to program a linear interpolation algorithm into Excel -- especially if you already understand how the lookup functions work. Essentially, linear interpolation consists of a lookup step (to locate the points that bracket the unkown data point) and an algebra step to calculate the desire y value at the given x value. We discuss linear interpolation quite frequently -- if you search the forum, you should find several examples of linear interpolation in action.

    The other "easy" interpolation algorithm to implement in Excel will be a curve fitting/regression type algorithm, where you assume a single function that will "fit" all of the points, then derive parameters for that function. Just how easy this one is will depend on how irregular your tank is. If the tank is still relatively simple (approximately spherical or cylindrical or rectangular or other simple shape), then the fitting equation can probably be fairly simple (you would probably start with some geometry before you got into Excel). If the tank is quite irregular, then it will probably be easier to simply resort to a different interpolation algorithm.

    FWIW, the four points you have posted do not look very irregular, so this may be fairly easy. From what I can see, either algorithm should work ok (depending on how accurate you feel you need to be).

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Find volume based on depth in relation to a fill table

    With your table in A:B, with data starting in A2, and the value of interest (900) in cell D2, you can use

    =TREND(OFFSET($B$2,MATCH(D2,$A$2:$A$7,-1),0,2,1),OFFSET($A$2,MATCH(D2,$A$2:$A$7,-1),0,2,1),D2)

    Change the 7s to the row number with the last value. This will interpolate between the two values closest to your entry - as long as the table is in descending order by depth.
    Last edited by Bernie Deitrick; 11-17-2014 at 03:59 PM.

  8. #8
    Registered User
    Join Date
    11-14-2014
    Location
    Bristol, England
    MS-Off Ver
    Excel
    Posts
    4

    Re: Find volume based on depth in relation to a fill table

    Excellent, nice one, thank you Bernie,

    Unfortunately it seem to return the wrong values...

    Putting in 1265 gives 1930.77 litres yet the table says 1265 = 1870 litres??? Also putting any value less than 221 gives an error, while the table goes down to 0 litres at 63.5cm.

    Cheers for all help so far!

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Find volume based on depth in relation to a fill table

    Try this formula

    =IFERROR(VLOOKUP(D2,A:B,2,FALSE),TREND(OFFSET($B$2,MATCH(D2,A:A,-1)-2,0,2,1),OFFSET($A$2,MATCH(D2,A:A,-1)-2,0,2,1),D2))

    Here is a workbook with a working example - with your data sorted by depth descending, as in the example.

    Interpolate value from list sorted descending.xlsx

  10. #10
    Registered User
    Join Date
    11-14-2014
    Location
    Bristol, England
    MS-Off Ver
    Excel
    Posts
    4

    Re: Find volume based on depth in relation to a fill table

    Perfect, that works, thank you very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help with VBA code to find bottom row in pivot table and fill table cell borders
    By Eric111 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2014, 07:15 PM
  2. sorting data based on depth ranges
    By justmcd in forum Excel General
    Replies: 1
    Last Post: 10-23-2013, 03:34 AM
  3. Replies: 7
    Last Post: 07-22-2013, 11:29 AM
  4. Find X with given Y in relation to a measured and recorded table of values
    By VanceLeeMeurer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-03-2012, 10:53 PM
  5. calculating based on a range of variable depth (VBA)
    By khajja in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2011, 07:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1