+ Reply to Thread
Results 1 to 6 of 6

VLOOKUP with variable column index

  1. #1
    Registered User
    Join Date
    08-16-2014
    Location
    Kuala Lumpur
    MS-Off Ver
    2010
    Posts
    19

    VLOOKUP with variable column index

    Hi guys, let say i have various layout each time I extracted the report, how do I make the column index will change the based on the result what I need. For example, in the sample, I required the result to lookup at Closing Balance everytime but next time I extract the report, the Closing Balance column might have change column position. Thanks in advance.
    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,926

    Re: VLOOKUP with variable column index

    Try this instead...
    =INDEX($G$2:$J$4,MATCH(M2,$F$2:$F$4,0),MATCH($N$1,$G$1:$J$1,0))
    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
    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,926

    Re: VLOOKUP with variable column index

    Anothetr option, keeping the vlookup...
    =VLOOKUP(M2,F2:J4,MATCH($N$1,$F$1:$J$1,0),0)

  4. #4
    Registered User
    Join Date
    08-16-2014
    Location
    Kuala Lumpur
    MS-Off Ver
    2010
    Posts
    19

    Re: VLOOKUP with variable column index

    it works great. thanks!

  5. #5
    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,926

    Re: VLOOKUP with variable column index

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  6. #6
    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,926

    Re: VLOOKUP with variable column index

    Thanks 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. VLOOKUP or INDEX/MATCH with multiple column index numbers
    By cerebral87 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-22-2017, 07:13 PM
  2. [SOLVED] Variable for column index for Vlookup in vba
    By Richavlaues in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2016, 10:33 AM
  3. Three Variable Match / Index (With different column headings)
    By burgie10 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-04-2015, 12:54 PM
  4. [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
  5. Macro to write Vlookup formula with variable column index
    By Ashali in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-08-2012, 09:40 PM
  6. Dynamic or Variable Lookup array in INDEX, MATCH or VLOOKUP
    By kishor_c in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-16-2012, 09:46 AM
  7. VLOOKUPS: When column index is variable, do what?
    By excelisfunsometimes in forum Excel General
    Replies: 1
    Last Post: 10-17-2011, 01:43 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