Hi there,
Here is my task:
I have a database of ~60,000 objects located at different parts of the world. Each object has 2 parameters to identify it on the surface of the Earth - unique Latitude (column A) and Longitude (column B) coordinates. I need a formula (or, to create a macro) which will loop through this dbase of coordinates and will list only those which are located within a perimeter of a certain square. E.g., say a user wants to see which objects are located between point_A = 30.000 deg (latitude), 40.000 deg (longitude) and point_B = 40.000 deg, 50.000 deg.
I tried VLOOKUP, COUNTIFS, etc. and the following macro endless number of times but they all don't work for me:
I will be grateful if you help me to solve this problem with either one of two:
(i) native Excel formula(s) - priority no.1
(ii) VBA macro - priority no.2, if it isn't possible to solve using formulas.
Thank you!
Rustam Alhas
Here is my task:
I have a database of ~60,000 objects located at different parts of the world. Each object has 2 parameters to identify it on the surface of the Earth - unique Latitude (column A) and Longitude (column B) coordinates. I need a formula (or, to create a macro) which will loop through this dbase of coordinates and will list only those which are located within a perimeter of a certain square. E.g., say a user wants to see which objects are located between point_A = 30.000 deg (latitude), 40.000 deg (longitude) and point_B = 40.000 deg, 50.000 deg.
I tried VLOOKUP, COUNTIFS, etc. and the following macro endless number of times but they all don't work for me:
Code:
Public Sub InAndOut()
Dim i As Integer
Dim j As Integer
Dim myArray(99, 1) As Integer
For i = 1 To 100
For j = 0 To 99
myArray(j, 1) = Range("Ai:Bi").Value
If myArray(j, 1) > Range("Ci:Di").Value Then
Range("Ei:Fi").Value = myArray(j, 1)
End If
Next j
Next i
End Sub
(i) native Excel formula(s) - priority no.1
(ii) VBA macro - priority no.2, if it isn't possible to solve using formulas.
Thank you!
Rustam Alhas
Last edited: