+ Reply to Thread
Results 1 to 3 of 3

Vlookup Search Function

  1. #1
    Registered User
    Join Date
    09-19-2011
    Location
    Earth
    MS-Off Ver
    Excel 2007
    Posts
    1

    Vlookup Search Function

    Hi all,

    I am new to the boards, so be friendly

    I am encountering a difficult situation when trying to complete a search on my data set. Without getting too deep into my data I have included the sample below to explain my dilemma.

    Without getting too specific my data field contains the following significant information.

    Item Number Price Valid Date Price Expiration Date
    ABCD 100.00 1/1/2009 12/31/2009
    ABCD 120.00 1/1/2010 07/31/2010
    ABCD 125.00 8/1/2010 12/31/9999
    EFGH 50.00 1/1/2009 12/31/9999

    I would like to search another set of data by Item Number and the date of purchase to retrieve the price.

    For example, I would like to know the price for item "ABCD" on 5/15/2010 by using some type of search function.

    My data set is large and pricing dates are irregular which has eliminated my ability to use a vlookup and match formula combination.

    Any help is appreciate.

    Thanks

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Vlookup Search Function

    Assuming that the dates for a price never overlap then is works for me ... =SUMPRODUCT(B1:B4,--(A1:A4="ABCD"),--(C1:C4<=DATE(2010,5,15)),--(D1:D4>=DATE(2010,5,15)))

  3. #3
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Vlookup Search Function

    How about a user defined function? copy and paste the below into a standard code module:
    Please Login or Register  to view this content.
    Use the function in the spreadsheet by typing:
    Please Login or Register  to view this content.
    Into the cell where you want the result to appear, then click the fx button to the left of the formula bar.

    For the ItemNumbers argument, select the range that contains the Item Numbers for which you want to find the price.

    For the strTargetItem argument, enter the Item number you want to match or select a cell that contains the item number used as a search cell (it doesn't have to be part of the data table).

    For the strDate, enter the date you want to match, or select a search cell containing the date.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1