Help Please

shellie78

New Member
Joined
Sep 17, 2014
Messages
9
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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

NeonRedSharpie

Well-known Member
Joined
Jul 14, 2014
Messages
1,678
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])
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,820
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You'll need an array formula unless your data is properly sorted:

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

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,652
Messages
5,838,591
Members
430,557
Latest member
MK15

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
Top