Forum Discussion
Getting a value from two different columns
- Nov 20, 2021
Aditya Jadhav Can see what you want to achieve though I see a slight problem. Your Geology list has 17 different ranges for code RL. To overcome that I renamed them to RL01 to RL17. Then I played around a bit with Power Query, without attempting to optimize the process. Ultimately, it gives you the Geo-codes for the lowest and highest values in the range. Perhaps this will help you in the other Geo-codes that fall between these two.
See attached.
Aditya Jadhav Can you please explain a bit more? For example, on the very first row, what would you like to return in the Geology column?
| Range1 | Range2 | Range | Geology |
| 523.96 | 537.8 | 537.8-523.96 |
The first geology column should get a text from the second geology column when the first range falls in between or is equal to the range in the next elevation column.
- Riny_van_EekelenNov 20, 2021Platinum Contributor
Aditya Jadhav As SergeiBaklan already mentioned, most ranges from the first table overlap two or more "Geology codes" in the second. So, my question stands. What would you type in cell D2 if you had to do it manually?
- Aditya JadhavNov 20, 2021Brass Contributor
For the manual thing have attached a sheet which has the logic and details written in it.
- Riny_van_EekelenNov 20, 2021Platinum Contributor
Aditya Jadhav Can see what you want to achieve though I see a slight problem. Your Geology list has 17 different ranges for code RL. To overcome that I renamed them to RL01 to RL17. Then I played around a bit with Power Query, without attempting to optimize the process. Ultimately, it gives you the Geo-codes for the lowest and highest values in the range. Perhaps this will help you in the other Geo-codes that fall between these two.
See attached.