+ Reply to Thread
Results 1 to 10 of 10

Need to vlookup by couple criterias

  1. #1
    Registered User
    Join Date
    10-15-2021
    Location
    Vilnius, Lithuania
    MS-Off Ver
    Office365
    Posts
    3

    Need to vlookup by couple criterias

    Hi,

    I'm having kind a strange situation and headache with this one task and need some help:
    In 1st excel I have this information:
    Debt Value Situation
    Invoice1 44460 SMS
    Invoice1 44461 email
    Invoice1 44462 letter
    Invoice1 44486 call
    Invoice2 44463 call


    2nd excel:

    Debt Value Situation
    Invoice1 44485

    I need somehow to vlookup the right one "Situation" in 2nd excel but Invoice1 has to be equal to Invoice1 from another excel and Value has to be lower than 44485 (from 2nd excel) but the highest from the 1st excel.

    So, the result has to be like this:
    Invoice1 44462 Letter. Situation: Letter because Invoice1=Invoice1; 44462 is lower than 44485 (from the 2nd excel) and the highest from the 1st excel.
    Invoice1 44486 means that isnt correct because in the 2nd excel 44485 value is lower than 44486
    Attached Files Attached Files
    Last edited by Edgaras; 10-18-2021 at 03:56 AM.

  2. #2
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Need to vlookup by couple criterias

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information (10-20 rows, not thousands...) and some manually calculated results. For a new thread (1st post), scroll to Manage Attachments, otherwise scroll down to GO ADVANCED, click, and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to vlookup by couple criterias

    As you are using Office 365 you can use new functions SORT and FILTER for instance this way:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    So first you filter only these elenets, where invoice is the same as in A2 and value is not larger than in B2
    FILTER(Sheet1!A2:C6,(Sheet1!B2:B6<=B2)*(Sheet1!A2:A6=A2))

    then you sort on column 2 descending
    SORT( result of FILTER ,2,-1)
    the desired result is in topmost row of sorted array, in third column, so you pick it by using INDEX
    INDEX( result of SORT ,1,3)

    I finally added IFERROR, to deal with situation where there is no such situation (say Invoice3 or value of 1000
    Best Regards,

    Kaper

  4. #4
    Registered User
    Join Date
    10-15-2021
    Location
    Vilnius, Lithuania
    MS-Off Ver
    Office365
    Posts
    3

    Re: Need to vlookup by couple criterias

    HI,

    I uploaded a small excel file with two 2sheets. One with the data and other with the manual results.

  5. #5
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    1,783

    Re: Need to vlookup by couple criterias

    2ndExcel_Manual_calculation

    D2=MAXIFS('1stExcel_Report'!$B$2:$B$25,'1stExcel_Report'!$A$2:$A$25,'2ndExcel_Manual_calculation'!A2,'1stExcel_Report'!$B$2:$B$25,"<="&'2ndExcel_Manual_calculation'!B2)

    Copy down


    C2=FILTER('1stExcel_Report'!$C$2:$C$25,('1stExcel_Report'!$B$2:$B$25='2ndExcel_Manual_calculation'!D2)*('1stExcel_Report'!$A$2:$A$25='2ndExcel_Manual_calculation'!A2),"")

    Copy down


    for me for ESO/002 44480 is 4450 not 4447

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to vlookup by couple criterias

    The only change from post#2 is the sheet name and the bottom of the range (some extra rows added in case you add more data to 1stExcelReport)

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The next formula is exactly the same but the column number in index function:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,428

    Re: Need to vlookup by couple criterias

    worksheet name : 2ndExcel_Manual_calculation
    Cell C2 formula , Drag down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-15-2021
    Location
    Vilnius, Lithuania
    MS-Off Ver
    Office365
    Posts
    3

    Re: Need to vlookup by couple criterias

    Thanks a lot guys!

  9. #9
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Need to vlookup by couple criterias

    I'm glad to see it worked for you.

    And thanks for marking thread solved and for a reputation point

  10. #10
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,428

    Re: Need to vlookup by couple criterias

    @Edgaras You're Welcome. Glad to help . Thank You for the feedback

+ 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. [SOLVED] VLOOKUP with 2 Criterias
    By MRozell in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-21-2017, 05:41 PM
  2. Filtering data based on couple criterias
    By Vinkel in forum Excel General
    Replies: 2
    Last Post: 02-17-2016, 05:31 AM
  3. [SOLVED] Vlookup with two criterias
    By lexusap in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-20-2013, 01:13 AM
  4. VLookup with different criterias
    By tobbem in forum Excel General
    Replies: 4
    Last Post: 11-28-2011, 05:35 AM
  5. Replies: 3
    Last Post: 08-22-2011, 02:48 AM
  6. Couple of quick questions - VLOOKUP maybe?
    By Bakks in forum Excel General
    Replies: 8
    Last Post: 06-03-2008, 10:50 PM
  7. Couple of vlookup queries
    By T De Villiers in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-27-2006, 03:35 PM

Tags for this Thread

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