(Solved) – Extract data from excel at specific rows and columns based on a criteria [closed]


PFA link to Excel file and Example Picture. I want to create a VBA program that will create 3 columns with the data extracted. The columns will have the same name as the columns where the data is been extracted from, in this case “UWI”, “X”, AND “Y”. This are directional surveys, I want to get the midpoint of each of them. This midpoint can be found in the same row as the closest match to the average of the first and last value of “Measured Depth” when the deviation angle is greater than 87 degrees and lower than 93 degrees for each of the directional surveys. There are around 2800 of them, each one of them starts with “Deviation Angle” and “Measured Depth” equal to 0 which could be used as a guide to find the last point, and the first point could be found as the first value when the deviation angle starts at 87 degrees and stays closer to 90 degrees atleast thats how I thought about it so far.

For r=1 to 100
    If Cells(8,r)>87 Then
    End If

    If Cells(8,r)=0 Then
        Num2 = Cells(8,r-1)
        Cells(9,r-1)=(Num1 Num2)/2
    End if
Next r
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *