Hi there,
I have two lists of coordinates (i.e. latitudes and longitudes), the second of which has a "sales count" associated with it. I want to get a sum of the "sales counts" occurring within x miles of the first list of coordinates. How would you suggest I do this?
See below:
[TABLE="width: 1063"]
<tbody>[TR]
[TD="align: right"][TABLE="width: 1063"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Radius[/TD]
[TD]100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Lat[/TD]
[TD]Long[/TD]
[TD]Sum Column G if within range B3[/TD]
[TD][/TD]
[TD]Lat 2[/TD]
[TD]Long 2[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]42.125793[/TD]
[TD]-72.645334[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]41.377698[/TD]
[TD]-104.660353[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]42.184835[/TD]
[TD]-71.947184[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.950896[/TD]
[TD]-110.553181[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]42.10273[/TD]
[TD]-72.080996[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.50537[/TD]
[TD]-110.786527[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]42.446396[/TD]
[TD]-71.459405[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.50537[/TD]
[TD]-110.786527[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]42.504844[/TD]
[TD]-71.201539[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.452793[/TD]
[TD]-110.739266[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]42.472112[/TD]
[TD]-70.997794[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.452793[/TD]
[TD]-110.739266[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]42.536996[/TD]
[TD]-70.973646[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.452793[/TD]
[TD]-110.739266[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]42.347207[/TD]
[TD]-71.086095[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]44.653104[/TD]
[TD]-107.024713[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]42.202216[/TD]
[TD]-71.005192[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.044268[/TD]
[TD]-111.008517[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]42.357564[/TD]
[TD]-71.211649[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]42.785695[/TD]
[TD]-110.186599[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]42.379146[/TD]
[TD]-71.184299[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.482361[/TD]
[TD]-110.839782[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]41.829813[/TD]
[TD]-70.138834[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.482361[/TD]
[TD]-110.839782[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The formula for the distance between lat/ long is =ACOS(COS(RADIANS(90-Lat1)) *COS(Radians(90-Lat2)) +SIN(RADIANS(90-Lat1)) *SIN(RADIANS(90-Lat2)) *COS(Radians(Long1-Long2))) *6371
I have two lists of coordinates (i.e. latitudes and longitudes), the second of which has a "sales count" associated with it. I want to get a sum of the "sales counts" occurring within x miles of the first list of coordinates. How would you suggest I do this?
See below:
[TABLE="width: 1063"]
<tbody>[TR]
[TD="align: right"][TABLE="width: 1063"]
<tbody>[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Radius[/TD]
[TD]100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Lat[/TD]
[TD]Long[/TD]
[TD]Sum Column G if within range B3[/TD]
[TD][/TD]
[TD]Lat 2[/TD]
[TD]Long 2[/TD]
[TD]Sales[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]42.125793[/TD]
[TD]-72.645334[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]41.377698[/TD]
[TD]-104.660353[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]42.184835[/TD]
[TD]-71.947184[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.950896[/TD]
[TD]-110.553181[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]42.10273[/TD]
[TD]-72.080996[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.50537[/TD]
[TD]-110.786527[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]42.446396[/TD]
[TD]-71.459405[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.50537[/TD]
[TD]-110.786527[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]42.504844[/TD]
[TD]-71.201539[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.452793[/TD]
[TD]-110.739266[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]42.472112[/TD]
[TD]-70.997794[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.452793[/TD]
[TD]-110.739266[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]42.536996[/TD]
[TD]-70.973646[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.452793[/TD]
[TD]-110.739266[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]42.347207[/TD]
[TD]-71.086095[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]44.653104[/TD]
[TD]-107.024713[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]42.202216[/TD]
[TD]-71.005192[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.044268[/TD]
[TD]-111.008517[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]42.357564[/TD]
[TD]-71.211649[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]42.785695[/TD]
[TD]-110.186599[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]16[/TD]
[TD]42.379146[/TD]
[TD]-71.184299[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.482361[/TD]
[TD]-110.839782[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]17[/TD]
[TD]41.829813[/TD]
[TD]-70.138834[/TD]
[TD]?[/TD]
[TD][/TD]
[TD]43.482361[/TD]
[TD]-110.839782[/TD]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The formula for the distance between lat/ long is =ACOS(COS(RADIANS(90-Lat1)) *COS(Radians(90-Lat2)) +SIN(RADIANS(90-Lat1)) *SIN(RADIANS(90-Lat2)) *COS(Radians(Long1-Long2))) *6371