Find first and last values based on one value

Wes

Board Regular
Joined
Jan 30, 2004
Messages
195
First I appologize if this has already been posted.

I need to find the First value and the last value of a range. A value is put into cell C12: number 1 for example and what happens is that excel will go down range H2:H9 and find the First Depth - "0" in this case and the last
Depth 100.
Daily Reporting Ver 1.0.3.xls
EFGHI
1CodeActivityBHADepth
21Rigup/TearDown10
37RigService10
42Drilling1100
56Trips2100
615PressureTest2100
74Coring2100
82Drilling2200
97RigService2200
10
11
12BHAValue1
13MinDepth
14MaxDepth
15
DailyReports


All help appreciated.
 
Les

I've created a userform called userform1 which has a textbox (txBhaNum), 2 labels (label1, label2) and a commandbutton.

The main macro loads the form
Sub main1()
UserForm1.Show

End Sub

The textbox has the following in the change area
Private Sub txBhaNum_Change()
Label1.Caption = Evaluate("=Max(--(a1:a10 = " & txBhaNum & ") * b1:b10 )")
Label2.Caption = Evaluate("=Min(if(a1:a10 = " & txBhaNum & ", b1:b10 ))")

End Sub
The commandbutton has the following code
Private Sub CommandButton1_Click()
Unload UserForm1
End Sub

The data on the spreadsheet was in the range A1:B9

Whenever the data was changed in the textbox, the labels reflected the results. Clicking the button closed the form.

HTH

Tony
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,216,176
Messages
6,129,314
Members
449,501
Latest member
Amriddin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top