# TVD and TVDss Calculator for deviated Oil Wells

Snippet used to calculate a central point data between two know data points

{note}
Snippet to calculate depths between two points in an Oil well survey by simple reggresion method.

Please type the well survey data for the first point
Depth MD: {formtext: name=MD1; default=1} Depth TVDss: {formtext: name=TVDss1; default=10} Depth TVD: {formtext: name=TVD1; default=5}
{if: catch(md1<= 0, yes)}{error: The MD of the first point is not greater than 0!; block=yes}{endif}

Please type the well survey data for the second point
Depth MD: {formtext: name=MD2; default=10} Depth TVDss: {formtext: name=TVDss2; default=10} Depth TVD: {formtext: name=TVD2; default=5}
{if: catch(md2<= md1, yes)}{error: The MD of the second point is not greater than MD from the first point!; block=yes}{endif}
Please type the measured depth at which you want to calculate TVDss and TVD: {formtext: name=MDreq; default=5}
{if: catch(md2<= mdreq, yes)}{error: The MD of the requested point is not lesser than MD from the second point!; block=yes}{endif}
{endnote}
{pendienteTVDss=(TVDss2-TVDss1)/(MD2-MD1)} {pendienteTVD=(TVD2-TVD1)/(MD2-MD1)}{InterseccionTVDss=TVDss2-(MD2pendienteTVDss)}{InterseccionTVD=TVD2-(MD2pendienteTVD)}Point 1 Survey: MD = {=MD1} TVDss = {=TVDss1} TVD = {=TVD1}

Calculated Point: MD = {=MDreq} TVDss = {=MDreqpendienteTVDss+interseccionTVDss; format=,.2f} TVD = {=MDreqpendienteTVD+interseccionTVD; format=,.2f}

Point 2 Survey: MD = {=MD2} TVDss = {=TVDss2} TVD = {=TVD2}