Creating a double lookup

  • Thread starter Thread starter Kenton
  • Start date Start date
K

Kenton

I need some assistance on creating a "double lookup." Essentially what I am
trying to do is the following:
Object: retrieve a number from multiple lists determined by company name and
date.
Source data would include a company name i.e. company A, B, or C and also
the date an order was placed. Those two criteria would need to be used in
order to determine the retrieved number.
For example, if the order is for company B on 08/28/08. I would need to
create a lookup that retrieves a number from list B for that date or later.
Any help would be much appreciated. Thank you.
 
Here is something I put together if the company name is in A1:A23, the
date is in column B, and the number to retrieve is in column C

Option Explicit
Sub test()
Dim cell As Range
Dim Co As String
Dim Dte As Date
Co = InputBox("Company Name")
Dte = InputBox("Date")
For Each cell In Range("A1:A23")
If cell.Value = Co Then
If cell.Offset(0, 1).Value = Dte Then
MsgBox cell.Offset(0, 2).Value
End If
End If
Next cell
End Sub
 
Still a little confused here. If anyone else could provide any additional
help, I would greatly appreciate it. Thanks.
 
Thank you. Thank you. I had to enter some additional information, i.e. fill
in all the dates as I was not doing a lookup but with that one small
exception this works perfectly. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top