Hi,
I have this equation. It works great. But only for one well at at time. I need to make it work for multiple wells.
(you dont really need to know exactly how the equation works just look to the WHAT I NEED part)
=INDEX(Survey!$C$2:$C$5,MATCH(IFERROR(LARGE(Survey!$B$2:$B$5,COUNTIF(Survey!$B$2:$B$5,">"&B2)+1),MIN(Survey!$B$2:$B$5)),Survey!$B$2:$B$5,0))
The equation goes into the Survey! worksheet and looks at one wells range of values between rows 2:5 (see below in bold)
INDEX(Survey!$C$2:$C$5,MATCH(IFERROR(LARGE(Survey!$B$2:$B$5,COUNTIF(Survey!$B$2:$B$5,">"&B2)+1),MIN(Survey!$B$2:$B$5)),Survey!$B$2:$B$5,0))
If B2 (see below in bold) falls within the Survey! sheet range it places a value from Survey! into the cell where I am running the equation.
INDEX(Survey!$C$2:$C$5,MATCH(IFERROR(LARGE(Survey!$B$2:$B$5,COUNTIF(Survey!$B$2:$B$5,">"&B2)+1),MIN(Survey!$B$2:$B$5)),Survey!$B$2:$B$5,0))
WHAT I NEED:
I was wondering if there was a way in VBA or in excel to update the equation.
I need to update the Survey! sheet part of the equation to change the range when the B2 part of the equation reaches a different well. (I feel like there is an better way to say that but I cant think of one).
This example will clear it up.
Here are my two data sheets
(Survey Sheet)
<colgroup><col width="118" span="3" style="width:89pt"> </colgroup><tbody>
</tbody>
(Sheet where the equation is run in column C (starting in C2))
<colgroup><col span="2"></colgroup><tbody>
</tbody>
So as you see there are two wells here, RA-0001 and RA-0002. The equation above is only run for RA-0001 (ie. the range Survey!(C2:C5) which is the range of values for RA-0001)
What I need is the equation to change when I get to a new well like RA-0002. (ie. I need the range to change to Survey!(C6:C7) when the equation gets to cell C4 in my equation sheet.)
For example when my equation reaches RA-0002 starting in row 4 I would want it to change to look like this:
INDEX(Survey!$C$6:$C$7,MATCH(IFERROR(LARGE(Survey!$B$6:$B$7,COUNTIF(Survey!$B$6:$B$7,">"&B4)+1),MIN(Survey!$B$6:$B$7)),Survey!$B$6:$B$7,0))
Basically what I need is some way to change the range of data to match to specific wells. I have no clue how to go about this in VBA or in Excel.
I tried to implement a Vlookup into the equation but could not figure out how to get it to work, if it even could.
Thank you for any ideas
Brandon
I have this equation. It works great. But only for one well at at time. I need to make it work for multiple wells.
(you dont really need to know exactly how the equation works just look to the WHAT I NEED part)
=INDEX(Survey!$C$2:$C$5,MATCH(IFERROR(LARGE(Survey!$B$2:$B$5,COUNTIF(Survey!$B$2:$B$5,">"&B2)+1),MIN(Survey!$B$2:$B$5)),Survey!$B$2:$B$5,0))
The equation goes into the Survey! worksheet and looks at one wells range of values between rows 2:5 (see below in bold)
INDEX(Survey!$C$2:$C$5,MATCH(IFERROR(LARGE(Survey!$B$2:$B$5,COUNTIF(Survey!$B$2:$B$5,">"&B2)+1),MIN(Survey!$B$2:$B$5)),Survey!$B$2:$B$5,0))
If B2 (see below in bold) falls within the Survey! sheet range it places a value from Survey! into the cell where I am running the equation.
INDEX(Survey!$C$2:$C$5,MATCH(IFERROR(LARGE(Survey!$B$2:$B$5,COUNTIF(Survey!$B$2:$B$5,">"&B2)+1),MIN(Survey!$B$2:$B$5)),Survey!$B$2:$B$5,0))
WHAT I NEED:
I was wondering if there was a way in VBA or in excel to update the equation.
I need to update the Survey! sheet part of the equation to change the range when the B2 part of the equation reaches a different well. (I feel like there is an better way to say that but I cant think of one).
This example will clear it up.
Here are my two data sheets
(Survey Sheet)
Wellname | MD | X |
RA-0001 | 0 | 964038.29 |
RA-0001 | 9253 | 988888.21 |
RA-0001 | 9256 | 988887.21 |
RA-0001 | 10337 | 964038.29 |
RA-0002 | 0 | 965555.35 |
RA-0002 | 9695 | 965555.35 |
<colgroup><col width="118" span="3" style="width:89pt"> </colgroup><tbody>
</tbody>
(Sheet where the equation is run in column C (starting in C2))
WELLNAME | TOP_DEPTH |
RA-0001 | 9238 |
RA-0001 | 9254 |
RA-0002 | 7609 |
RA-0002 | 7630 |
RA-0002 | 7630 |
<colgroup><col span="2"></colgroup><tbody>
</tbody>
So as you see there are two wells here, RA-0001 and RA-0002. The equation above is only run for RA-0001 (ie. the range Survey!(C2:C5) which is the range of values for RA-0001)
What I need is the equation to change when I get to a new well like RA-0002. (ie. I need the range to change to Survey!(C6:C7) when the equation gets to cell C4 in my equation sheet.)
For example when my equation reaches RA-0002 starting in row 4 I would want it to change to look like this:
INDEX(Survey!$C$6:$C$7,MATCH(IFERROR(LARGE(Survey!$B$6:$B$7,COUNTIF(Survey!$B$6:$B$7,">"&B4)+1),MIN(Survey!$B$6:$B$7)),Survey!$B$6:$B$7,0))
Basically what I need is some way to change the range of data to match to specific wells. I have no clue how to go about this in VBA or in Excel.
I tried to implement a Vlookup into the equation but could not figure out how to get it to work, if it even could.
Thank you for any ideas
Brandon