Hi Everyone!

I'm trying to calculate the length between two points using their Northing, Easting and Elevation values. Currently I have been exporting my shape file and calculating these valves in excel but would like to find a way to do this in ESRI so it is part of the shapefile. Is there a way to use the field calculator to create an expression that uses multiple fields and multiple rows? I'm currently using ArcGIS 10.2.2

For example:

A | B | C | D | ||

1 | Northing | Easting | Elevation | Calc Field | Result |

2 | 5248152.6 | 585984.4 | 6.845 | 0 | 0.00 |

3 | 5248152.5 | 585984.31 | 6.805 | =SQRT((A3-A2)^2+(B3-B2)^2+(C3-C2)^2) | 0.16 |

4 | 5248152.4 | 585984.23 | 6.882 | =SQRT((A4-A3)^2+(B4-B3)^2+(C4-C3)^2) | 0.13 |

5 | 5248152.3 | 585984.16 | 6.805 | =SQRT((A5-A4)^2+(B5-B4)^2+(C5-C4)^2) | 0.13 |

I'm familiar with VBA but not so much python.

Thanks in advance!

This is a case where using global, see Freddie Gibson's code, is likely the most readable, especially to people new to Python. There are those who argue we should avoid using global unless absolutely necessary. For this case, a Python generator can be used to avoid using global.

The above code goes in the codeblock and distance.send((!Northing!, !Easting!, !Elevation!)) would go in the field box.

I haven't tested the above code, so let me know if there are issues with it if you try it.