+ Reply to Thread
Results 1 to 8 of 8

Replicating a 2 variable index and match

  1. #1
    Forum Contributor
    Join Date
    12-02-2014
    Location
    England
    MS-Off Ver
    2010 | 2016
    Posts
    167

    Replicating a 2 variable index and match

    Morning all,

    I'm currently running into a road block with replicating a formula which matches a value only when 2 variables are matched.

    I had some limited success with using 2 declared variables and using while x = x and y = y however it wasn't dynamic enough to get all the paired variables.

    I've attached a spreadsheet with sample data, basically what i'm trying to achieve is....

    I have a very large data set which is loosely set up like columns F, G & H; and another data set, which is out of my control in shape and format, as shown in columns B, C & D. All i want to do is return the correct cost per pairing of JobCode & Workstage.

    I can appreciate this is probably the simplest of problems but any help would be greatly appreciated.

    Many thanks,

    Harry.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Replicating a 2 variable index and match

    Not sure why you postedthis in the VBA forum (mistake maybe), but try this formula...
    =INDEX($H$3:$H$22,MATCH(B3&" "&C3,INDEX($F$3:$F$22&" "&$G$3:$G$22,0),0))
    copied down as needed
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    12-02-2014
    Location
    England
    MS-Off Ver
    2010 | 2016
    Posts
    167

    Re: Replicating a 2 variable index and match

    Because this will form part of a larger routine that i'm running on a very large data set.

    The formula I had in before is taking too long to run so optimising via VBA was the preferred solution.

    Thanks,

    Harry.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Replicating a 2 variable index and match

    VBA
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-02-2014
    Location
    England
    MS-Off Ver
    2010 | 2016
    Posts
    167

    Re: Replicating a 2 variable index and match

    Quote Originally Posted by jindon View Post
    VBA
    Please Login or Register  to view this content.
    That seems to work absolutely perfectly, however i can't understand how.

    Sorry to be a pain - but could you elaborate?

    Many many thanks.

    Harry.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Replicating a 2 variable index and match

    Loop through look up table, F4:Hx.

    Store Col.H value in item property of dictionary for each unique key value of concatenate string Col.F & Col.G.

    Loop through the data table and output the stored item value in dictionary for key concatenate string of Col.B & C.

    Get vb help for dictionary object in detail...

    Also used Array for speeding up.

  7. #7
    Forum Contributor
    Join Date
    12-02-2014
    Location
    England
    MS-Off Ver
    2010 | 2016
    Posts
    167

    Re: Replicating a 2 variable index and match

    Thankyou very much.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Replicating a 2 variable index and match

    glad you got your answer

+ 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. INDEX/MATCH with a variable MATCH lookup_array?
    By mrbusto71 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-22-2017, 03:27 PM
  2. 2 variable index match with wildcard
    By izk630 in forum Excel General
    Replies: 4
    Last Post: 10-26-2015, 02:42 PM
  3. [SOLVED] Converting Hlookup to Index Match with variable column index number
    By SimonLock in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-09-2015, 09:14 AM
  4. Index Match + Range Variable
    By genichigo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-10-2014, 11:26 AM
  5. 2 Variable + Qty Use INDEX/MATCH but how?
    By heatwave in forum Excel General
    Replies: 3
    Last Post: 09-11-2010, 01:53 AM
  6. Set VBA Variable with Index/Match Array
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2010, 11:36 PM
  7. Three variable lookup/index/match whatever
    By manalex in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-21-2005, 11:05 PM

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