Hi,
I have a question that is kinda complected. But can definitely be done in VBA.
I have data that gives a well name and a depth in one worksheet, and I have other data that gives a well name and a depth in the other worksheet.
The second worksheet has Surfaces associated with its depths. The first worksheet has pressures associated with its depths.
The pressure depths are rarely exactly equal to the well top depths but the pressure depths always fall within the interval of the shallower surface to the deeper surface.
What I need is to fill a column with the Surface name associated with its pressure depth. (ie, if a specific wells pressure falls within that wells surface interval I need that pressure to have the name of the shallower surface.)
As seen below it is a little easier to understand. The first excel sheet is the well, MD, and Surface. The second sheet is the Well, MD, Pressure, (THEN it has a surface column which I filled in two surfaces that would show up if the VBA code ran.) As you can see, Z51CH is at a depth of 9220 in the second worksheet, this is because that depth falls between Z51CH (9204.9) and Z51 (9232.9).
<tbody>
</tbody>
<tbody>
</tbody>
I have a question that is kinda complected. But can definitely be done in VBA.
I have data that gives a well name and a depth in one worksheet, and I have other data that gives a well name and a depth in the other worksheet.
The second worksheet has Surfaces associated with its depths. The first worksheet has pressures associated with its depths.
The pressure depths are rarely exactly equal to the well top depths but the pressure depths always fall within the interval of the shallower surface to the deeper surface.
What I need is to fill a column with the Surface name associated with its pressure depth. (ie, if a specific wells pressure falls within that wells surface interval I need that pressure to have the name of the shallower surface.)
As seen below it is a little easier to understand. The first excel sheet is the well, MD, and Surface. The second sheet is the Well, MD, Pressure, (THEN it has a surface column which I filled in two surfaces that would show up if the VBA code ran.) As you can see, Z51CH is at a depth of 9220 in the second worksheet, this is because that depth falls between Z51CH (9204.9) and Z51 (9232.9).
Well | MD | Surface |
RA-0074 | 9204.9 | Z51CH |
RA-0074 | 9232.9 | Z51 |
RA-0074 | 9237.3 | Z48CH |
RA-0074 | 9250.93 | Z48 |
RA-0074 | 9313.2 | Z46CH |
RA-0074 | 9415.6 | Z46 |
<tbody>
</tbody>
Well identifier | MD | FPRESS | SURFACE |
RA-0074 | 8953 | 4185.8 | |
RA-0074 | 9000 | 4220 | |
RA-0074 | 9028 | 4245 | |
RA-0074 | 9110 | 4292 | |
RA-0074 | 9165 | 4244.7 | |
RA-0074 | 9166 | 4244.6 | |
RA-0074 | 9182 | 4220.4 | |
RA-0074 | 9220 | 4238.1 | Z51CH |
RA-0074 | 9350 | 4270.5 | Z46CH |
RA-0074 | 9447 | 4312 | |
RA-0074 | 9539 | 4352 | |
RA-0074 | 9570 | 4372.8 | |
RA-0074 | 9641 | 4539 | |
RA-0074 | 9666 | 4834 |
<tbody>
</tbody>