Multiple Lookup Values

GRobertson

New Member
Joined
Jul 4, 2016
Messages
2
Hi,
I have a spreadsheet containing data.
Column A - Contains Supplier (e.g. BG, EON, EDF)
Column B - Contains Status (e.g. Open, Closed, Completed, Cancelled)
Column C - Contains a Date

If want a formula in Cell A1, that says for example. If Column A contains "BG" and Column B contains "Open" the cell A1 is to display the oldest date.
 
Are you checking for "Open" on the same row as "BG" or can "Open" occur ANYWHERE in column B irrespective of where "BG" is found in column A ?
 
Upvote 0
So if my data is in rows

Column A Column B Column C
BG open 01/06/2016
EON open 01/05/2016
BG Open 01/07/2016
WOn Closed 31/01/2016

I want a formula that for example will search and display the oldest date for any record where column a equals Bg and column B equals Open. So in the example about the result should be 01/06/2016
 
Upvote 0
Hi,

Try this one:

Code:
Option Compare Text

Sub Test()
Dim Arr As Variant
Arr = Range("A1:C" & Range("A" & Rows.Count).End(xlUp).Row)

Dim x As Integer
Dim success As Integer
Dim Result As Date

Result = Format(Result, "Short Date")

For x = 1 To UBound(Arr, 1)

    If Arr(x, 1) = "BG" And Arr(x, 2) = "Open" Then
        
            If success = 0 Then
                
                success = 1
                Result = Arr(x, 3)
                
            End If
            
            If Result > Arr(x, 3) Then Result = Arr(x, 3)
        
    End If

Next x

MsgBox Result

End Sub

Hope this helps,
Zoliidais
 
Last edited:
Upvote 0

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