If it's a one off for a specific project then it's probably a good idea but bear in mind that whilst one or two instances of a custom vlookup UDF wouldn't take too long to recalc, if you have a dataset of several hundred (or thousand) records that you'll need to use this for, it's gonna be recalcing for a loooooong time. I have actually done similar (within a sub) for one of my "databases" in excel where there can be duplicate values and I need to check which one is the active record:
With dbWBdbSht
Set fCell = .Columns("D"

.Find(mOutlet, LookIn:=xlValues, Lookat:=xlWhole)
firstaddress = fCell.Address
'test to see if flag is "ACTIVE"
If fCell.Offset(0, 10).Text <> "ACTIVE" Then
Do
Set fCell = .Columns("D"

.FindNext(fCell)
Loop While Not fCell Is Nothing And fCell.Address <> firstaddress And fCell.Offset(0, 10).Text <> "ACTIVE"
'do stuff on record found with ACTIVE flag
Else
'do stuff on first record found
End If
End With
This could be easily modded to find the 2nd or 3rd instance and return a value in a UDF
Rgds, Geoff
Si hoc legere scis, nimis eruditionis habes
Want the
best answers to your questions ? - then read me baby one more time - faq222-2244