+ Reply to Thread
Results 1 to 6 of 6

VBA/Vlookup/Idex match

  1. #1
    Registered User
    Join Date
    06-26-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    9

    VBA/Vlookup/Idex match

    I have a workbook with two worksheet. Please help me out with anything Vlookup/Index match, VBA etc..

    On sheet1 I have column A= item number, column G=price and column M=location. On sheet2 I have column A= item number, column D=-lot, column G=price and column M=location.

    But on sheet2 on Column A has same item number with multiple rows with different lot on column D. is there a way that can be done in VBA/Vlookup anything that look up the oldest lot and copy price and location to sheet1? Help me out please. I spent hours pretty much of my work day search each item copy and paste. Attachment is an example



    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA/Vlookup/Idex match

    LOL.

    You sound desperate.

    So I will look at this for you.

    Ok

    Paste this formula into cell B2 using Ctrl Shift Enter. you should get the result 343

    =LARGE(IF(A3=Sheet2!A1:A20000,ROW(A1:A20000),0)*IF(Sheet2!J1:J20000>1,1,0),1)

    This is the largest row in Column J that has the same part number and at least one item ready to ship.


    This formula is slightly differrent and returns the largest row with at least the number of items as on the order
    =LARGE(IF(A3=Sheet2!A1:A20000,ROW(A1:A20000),0)*IF(Sheet2!J1:J20000>=D3,1,0),1)


    Once you have the row number it is simple to use the index function to return the appropriate dats

    Eg to return the sale price

    =INDEX(Sheet2!M1:M2000,B2,1)


    or

    Entered using Ctrl Shift Enter.
    =INDEX(Sheet2!M1:M2000,LARGE(IF(A3=Sheet2!A1:A20000,ROW(A1:A20000),0)*IF(Sheet2!J1:J20000>1,1,0),1),1)
    Last edited by mehmetcik; 10-16-2019 at 05:42 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    06-26-2018
    Location
    USA
    MS-Off Ver
    2017
    Posts
    9

    Re: VBA/Vlookup/Idex match

    Quote Originally Posted by mehmetcik View Post
    LOL.

    You sound desperate.

    So I will look at this for you.

    Ok

    Paste this formula into cell B2 using Ctrl Shift Enter. you should get the result 343

    =LARGE(IF(A3=Sheet2!A1:A20000,ROW(A1:A20000),0)*IF(Sheet2!J1:J20000>1,1,0),1)

    This is the largest row in Column J that has the same part number and at least one item ready to ship.


    This formula is slightly differrent and returns the largest row with at least the number of items as on the order
    =LARGE(IF(A3=Sheet2!A1:A20000,ROW(A1:A20000),0)*IF(Sheet2!J1:J20000>=D3,1,0),1)


    Once you have the row number it is simple to use the index function to return the appropriate dats

    Eg to return the sale price

    =INDEX(Sheet2!M1:M2000,B2,1)


    or

    Entered using Ctrl Shift Enter.
    =INDEX(Sheet2!M1:M2000,LARGE(IF(A3=Sheet2!A1:A20000,ROW(A1:A20000),0)*IF(Sheet2!J1:J20000>1,1,0),1),1)

    Yes, I'm desperate in need of help. Can you please paste the formula on the file for me? I tried pasting on B2 nothing happen.


    Thanks

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,842

    Re: VBA/Vlookup/Idex match

    If you re-read mehmetcik's response, you'll note the first formula is an "Array formula". This means that when you enter that formula, DO NOT just hit enter key, but hit the Shift, Ctrl, and Enter keys at the same time.

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: VBA/Vlookup/Idex match

    Columns B and H ammened
    Attached Files Attached Files

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: VBA/Vlookup/Idex match

    éConfuze
    Administrative Note:

    Please don't quote entire posts unnecessarily. They are just clutter and make threads hard to read.
    Use the "Quick reply" instead
    Thanks

+ 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 or index or idex or ??????
    By elew69811 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-30-2016, 12:00 AM
  2. How can I have an idex formula and if zero in 1 cell?
    By jessicabahl in forum Excel General
    Replies: 3
    Last Post: 10-11-2016, 10:09 AM
  3. value into Textbox equal idex column
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2016, 02:25 PM
  4. [SOLVED] Vlookup to Pivot Table, using Match function, returns error if can't find match value
    By AndrewHowarth in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-16-2015, 12:10 AM
  5. Replies: 11
    Last Post: 06-21-2013, 03:25 AM
  6. Replies: 13
    Last Post: 12-13-2012, 11:44 AM
  7. Idex number relating to name
    By Back2Basics in forum Excel General
    Replies: 2
    Last Post: 02-12-2009, 06:54 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