Iterating trig function and removing data over a given limit and returning values....

steve manos2

New Member
Joined
May 6, 2017
Messages
9
Find all possible TREE (code names) and their DISTANCES (m), within a given Radius (600m), from the center of the subject tree [eg tree 2], and return the codename of all the trees and distances to the subject tree.


The result(s) should be in order of closest (Min) to furthest (Max) from the subject tree as in XL table below. Then repeat the above for each and every subject tree until the Excel table below is populated:


My Problem:
Figuring to employee simple trig to calculate the distances from the X&Y location data (m) and then cast out any values greater than the Radius.


In reality I have 30 000+ Trees in this forest with their locations described in XY coordinate meters this really isn't an issue and figure I could alter VBA code to accommodate any size of population im dealing with but I don’t know how to iterate every tree against the other 29 999 possibilities and then put the resultant(s) into one cell from min to max separated by a semi colon.


I guess I could also write out the resultants into multiple columns and that would work too


... Any ideas folks??

(I tried to paste a markup drawing to make this problem more digestible but gave up after an hour) I can email it if a clearer understanding is needed.

600m
TREE 1
100
6194979
651942

TREE 2
75
6193548
653771
TREE 3 (Hyp2) ; Tree 4 (Hyp 1)
TREE 3
60
6195210
652614

TREE 4
90
6195134
652243

TREE 5
25
6193738
654033


<tbody>
[TD="bgcolor: #d6d7ff"]
Tree Name
[/TD]
[TD="bgcolor: #d6d7ff"]
TREE HEIGHT (m)
[/TD]
[TD="bgcolor: #d6d7ff"]
UTM Y(m)
[/TD]
[TD="bgcolor: #d6d7ff"]
UTM X(m)
[/TD]
[TD="bgcolor: #d6d7ff"]
Nearest Tree(s) & Distance(s) meters [based on Radius constant]
[/TD]
[TD="bgcolor: #d6d7ff"]
R (RADIUS)
[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #d6d7ff"]

[/TD]
[TD="bgcolor: #d6d7ff"]

[/TD]
[TD="bgcolor: #d6d7ff"]

[/TD]
[TD="bgcolor: #d6d7ff"]

[/TD]
[TD="bgcolor: #d6d7ff"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]
[TD="bgcolor: #000000"]

[/TD]

</tbody>
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,225,262
Messages
6,183,902
Members
453,194
Latest member
himanshuhun

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top