I'm working on a problem where I have to assign a multiplier to a data entry based on the geographic region in which it is located. Each region has been defined as a square with two corner coordinates (see data below), and I need to return the region number that a third set of coordinates falls within. For the one set of regions I have it figured out using nested if statements as there are only 7 regions, however there is a second region map with dozens of regions and I would like to be able to perform the same exercise for that map without having to use dozens of nested IF statements. Is there a better way?
For example, if I had coordinates TWP = 40, RG = 18, Meridian =4, then it would return Area =2 (since it is between the coordinates in row 3).
<tbody>
</tbody>
For example, if I had coordinates TWP = 40, RG = 18, Meridian =4, then it would return Area =2 (since it is between the coordinates in row 3).
TWP | Rg | Meridian | Area | |||
1 | 50 | 1 | 16 | 4 | 1 | |
1 | 59 | 16 | 30 | 4 | 2 | |
1 | 59 | 1 | 7 | 5 | 2 | |
1 | 59 | 7 | 30 | 5 | 3 | |
1 | 59 | 1 | 13 | 6 | 3 | |
59 | 92 | 21 | 30 | 5 | 3 | |
59 | 92 | 1 | 13 | 6 | 3 |
<tbody>
</tbody>