Skip to main content

Posts

Featured

Calculate the Center/Average of Multiple Coordinate Points with Excel VBA

  I wanted to calculate a good center/average point for a cluster of geographic coordinates in Excel VBA and came across a JavaScript solution here . All I had to do was rewrite all the logic in VBA. The only real challenge was realizing that Excel's Atan2 function takes (x, y) while JavaScript's atan2 function takes (y, x). Here is my solution: Function AverageGeolocation ( ByRef aCoords ) As Coord '''Calculate the center/average of multiple Geolocation coordinates '''Expects array of objects named Coord with .latitude and .longitude properties     Dim cOut As New Coord     Dim x As Double     Dim y As Double     Dim z As Double     Dim latitude As Double     Dim longitude As Double     Dim i As Long     Dim Math As Object     Dim total As Double     Dim centralLongitude As Double     Dim centralSquareRoot As Double...

Latest Posts

How to Calculate Distance Between Two Coordinate Points with Excel VBA

How to Inject Methods into Python Classes with Decorators

How to Make a Python Miltidict Class

How to Make a Python Class Immutable

Python Using Regex on Entire Excel File

Excel VBA Using Regex on Entire Spreadsheet