excel - Comparing goegraphic points where X and Y are in two columns -
i have huge data set x , y coordinates in them. i'm looking see if 2 events close each other in proximity, , if so, highlight events or pull them out , put them in separate worksheet.
x coordinates in column v
y coordinates in column w
i looking points within given distance of each other. want either highlight or put them in new worksheet.
one question how report this. might have 2 points close each other far 2 other point close each other.
my goal take list of thousands of events , pull out ones close each other on map without having search through them all. data set continuously growing huge time saver in long run.
i'm not sure if want compare x coords. find 2 x coords close y coords far apart. not sure if want, things close in 1 aspect. if want loop rows subtracting 1 another. if want find distance between 2 geographic points see below.
you can distance between 2 points using pythagorean theorem.
dim origpoint double dim checkpoint double dim distance double origpoint = point1x - point2x checkpoint = point1y - point2y distance = sqr((origpoint * origpoint) + (checkpoint * checkpoint)) if distance < 300 'copy or highlight data end if
you need loop rows doing this. using these in code above compare point on current row point on next row.
origpoint = activeworkbook.sheets("sheet1").range("v" & lrow).value - activeworkbook.sheets("sheet1").range("v" & lrow + 1).value checkpoint = activeworkbook.sheets("sheet1").range("w" & lrow).value - activeworkbook.sheets("sheet1").range("w" & lrow + 1).value
Comments
Post a Comment