#### shellie78

##### New Member
I am doing financial modelling and require to do a VLOOKUP to an area and get a match to a locoation. This location has a date in another column that is in the array area. I am able to do this but once it has found all the matching locations I then wish it to populate the cell with the earliest lcation date and I do not know how to do this after I have asked it to look for the location.

So say the area is C1:H13 and the location is in B100 The location is in C column and dates in H column. I do =IF(ISERROR(VLOOKUP(B100,C1:H13,1,FALSE)),"",VLOOKUP(B100,C1:H13,2,FALSE)). This would give me a date if there was only one matching location but as there is more than one matching location I require the earliest date ie Aug 15 if that was the earliest so what is the next command?

Any help would be greatly apprecaited.

### Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Code:
``````Function MINIF(vals As Range, rng As Range, criteria As Range) As Variant

check = 100000000

For Each cell In rng
If cell.Value = criteria.Value And vals(cell.Row) < check Then
Debug.Print cell.Row
Debug.Print vals(cell.Row)
MINIF = vals(cell.Row)
check = MINIF
End If

Next

End Function``````

I have this UDF I wrote the other day that should help you out.

Code:
``=MINIF([date_range],[location_range],[location])``

You'll need an array formula unless your data is properly sorted:

=MIN(IF(C1:C13=B100,H1:H13))
entered with Ctrl+Shift+Enter.

Replies
4
Views
185
Replies
3
Views
303
Replies
1
Views
270
Replies
1
Views
289
Replies
9
Views
694

1,218,909
Messages
6,145,167
Members
450,592
Latest member
Boulder127

### 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.

### Which adblocker are you using?

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

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