+ Reply to Thread
Results 1 to 5 of 5

VLOOKUP formula, cell reference as column index number

  1. #1
    Registered User
    Join Date
    07-31-2014
    Location
    Australia
    MS-Off Ver
    MS Excel 2007
    Posts
    27

    VLOOKUP formula, cell reference as column index number

    Hi I am trying to use a cell and enter a number that will be used as a reference instead of hard coding the number I formula below as Col_index_num.
    .
    =IF(B598="",Q598,VLOOKUP(B598,INDIRECT("'["&G598&".xlsx"&"]"&H598&"'!"&"$A:$AE"),8,0))

    What syntax should I use?

    Thanks.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: VLOOKUP formula, cell reference as column index number

    Simply replace 8 in the formula with the cell reference that contains a number in it.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: VLOOKUP formula, cell reference as column index number

    With the INDIRECT function you don't need the absolute reference so this will suffice:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    As for the column index number, simply replace the 8 with the cell reference, so if the number was in H1 try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I made the row absolute as I am assuming you will be dragging the formula down without wanting to change the column index number.
    Please add reputation by clicking on the * if I have helped.
    Please mark the thread SOLVED if your issue has been resolved.
    Thanks, Glenn.

  4. #4
    Registered User
    Join Date
    07-31-2014
    Location
    Australia
    MS-Off Ver
    MS Excel 2007
    Posts
    27

    Re: VLOOKUP formula, cell reference as column index number

    Thanks for that. I think it didn't work before because I didn't have both files open.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: VLOOKUP formula, cell reference as column index number

    Quote Originally Posted by Bobz1983 View Post
    Thanks for that. I think it didn't work before because I didn't have both files open.
    Yes, if using the INDIRECT function to build a reference to another file that file must be open for the formula to work properly.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Replies: 4
    Last Post: 01-13-2014, 04:16 AM
  2. [SOLVED] VLOOKUP to reference cell, not column number
    By Prodschdler in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-18-2013, 02:27 PM
  3. Replies: 3
    Last Post: 04-10-2013, 06:33 AM
  4. How to use INDEX and a column number or reference
    By skysurfer in forum Excel General
    Replies: 6
    Last Post: 05-16-2010, 06:49 AM
  5. Insert a formula with relative cell reference based on a number in a column
    By Dcritelli in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-16-2007, 05:54 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