+ Reply to Thread
Results 1 to 5 of 5

Lookup based on data in 2 columns

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    15

    Lookup based on data in 2 columns

    Hi

    I want to come up with a lookup formula to find data based on looking at data from 2 columns.

    I've attached an example file of what I want to do - the columns highlighted in yellow are the columns to lookup - the 'Concatenated' column is exact match, and the 'Time' column is within 5 minutes (i.e. the Time on main sheet is original time entered in one database, the Time on lookup data sheet is time entered in another database shortly after, so Time on lookup data sheet will always be slightly later but within 5 minutes of time on first sheet).

    Is there a way to match both these columns to the lookup sheet so as to bring back the data in the Data columns?

    Regards
    John
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,982

    Re: Lookup based on data in 2 columns

    Add "helper" column in J of "Lookup Data"

    =D2&E2

    Copy down


    in F2 of "Main Sheet"


    =IFERROR(INDEX('Lookup Data'!F$2:F$22,MATCH($D2&$E2,'Lookup Data'!$J$2:$J$22,1)+1),"")

    copy across and down
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    01-13-2011
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Lookup based on data in 2 columns

    hi - thanks, but I dont think that's entirely accurate - the "Helper" column wont have exact times so I dont know how that will work accurately? I dont see where in the formula that it takes into account the small difference in time of up to 5 minutes. How is it matching accurately?

    And I can see that it's not working for all the data - for example, row 5 on Main sheet is not pulling back data?

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,982

    Re: Lookup based on data in 2 columns

    Try

    in F2 ("Lookup Data"

    =INDEX('Lookup Data'!F$2:F$21,MATCH(1,('Lookup Data'!$D$2:$D$21='Main Sheet'!$D2)*('Lookup Data'!$E$2:$E$21>='Main Sheet'!$E2-TIME(0,5,0))*('Lookup Data'!$E$2:$E$21<='Main Sheet'!$E2+TIME(0,5,0)),0))

    Enter with Ctrl+Shift+Enter


    Copy across and down
    Last edited by JohnTopley; 03-07-2017 at 06:23 PM.

  5. #5
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,662

    Re: Lookup based on data in 2 columns

    Non-array formula in F2:
    I do not use the concatenate column.
    Please Login or Register  to view this content.
    Quang PT

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Lookup based on multiple columns
    By JJones5 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 04-15-2016, 04:18 PM
  2. [SOLVED] Lookup/Match from 2 worksheet & populate data based on lookup
    By plcouch in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-22-2015, 08:16 PM
  3. Lookup values based on criteria in two columns
    By ola7mat in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-11-2012, 10:14 AM
  4. Lookup 2 columns and return value based on another 2 columns
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 11:16 AM
  5. Lookup values based on 2 columns
    By blaketanon in forum Excel General
    Replies: 2
    Last Post: 11-04-2010, 01:03 PM
  6. lookup based on two columns
    By DKerr in forum Excel General
    Replies: 1
    Last Post: 01-31-2007, 02:13 PM
  7. [SOLVED] how do I lookup data based on two columns of data
    By bttreadwell in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-19-2005, 12:00 AM

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