I'm slowly trying to make way in my distance calculation project...
Here is the current problem.
I have function in order to calculate as-the-crow flies distance between two sets of coordinates.
The Lat1 and Long1 values will be on the same worksheet as the above function (columns B and C) so it's an easy point and click:
However I need the Lat2 and Long2 values to be populated via user entering a zipcode in cell E109 of the "Minnesota" worksheet . I have thus come up with a VLOOKUP:
giving me the following final function:
Thanks!
Here is the current problem.
I have function in order to calculate as-the-crow flies distance between two sets of coordinates.
=6371*((2*ASIN(SQRT((SIN((RADIANS(Lat1)-RADIANS(Lat2))/2)^2)+ COS(RADIANS(Lat1))*COS(RADIANS(Lat2))*(SIN((RADIANS(Long1)-RADIANS(Long2))/2)^2)))))
The Lat1 and Long1 values will be on the same worksheet as the above function (columns B and C) so it's an easy point and click:
However I need the Lat2 and Long2 values to be populated via user entering a zipcode in cell E109 of the "Minnesota" worksheet . I have thus come up with a VLOOKUP:
for Lat2(=VLOOKUP(Minnesota!E109,zipcodes!A:C,2,FALSE)
for Long2(=VLOOKUP(Minnesota!E109,zipcodes!A:C,2,FALSE)
giving me the following final function:
However Excel tells me the formula above contains an error. Any idea why? Is having a few VLOOKUPs within the original function not possible?=6371*((2*ASIN(SQRT((SIN((RADIANS(=VLOOKUP(Minnesota!E109,zipcodes!A:C,2,FALSE))-RADIANS(zipcodes!B2))/2)^2)+COS(RADIANS(=VLOOKUP(Minnesota!E109,zipcodes!A:C,2,FALSE)))*COS(RADIANS(zipcodes!B2))*(SIN((RADIANS(=VLOOKUP(Minnesota!E109,zipcodes!A:C,3,FALSE))-RADIANS(zipcodes!C2))/2)^2)))))
Thanks!