+ Reply to Thread
Results 1 to 7 of 7

Vlookup changing array

  1. #1
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Vlookup changing array

    Hi All,

    I have come across an interesting problem concerning the vlookup function. What i am trying to do is to make the lookup array change based on criteria. So the row of the array may never be the same. for example one month the formula may be:

    =VLOOKUP(A2,$M$2:$P$25,2,FALSE)

    but when the user updates the form the next month the formula needs to be:

    =VLOOKUP(A2,$M$2:$P$46,2,FALSE)

    I can recognize the row number that i need to go to, in the examples 25 or 46, but i do not know how to put a changing value in the lookup array of the function.

    Any help is greatly appretiated. Thanks!

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,028

    Re: Vlookup changing array

    How do you determine (or where is stored) row number (25,46...)
    Never use Merged Cells in Excel

  3. #3
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Vlookup changing array

    I have it stored in say A3, it is just a countif statement because in L1:L2000, i have numbers that repeat so like 20-1's, 20-2'2, so i am counting the number of 1's to give me the number that my array needs to go down to. Hope this helps. Thanks!

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,028

    Re: Vlookup changing array

    For example, let say you have row number in A3:

    =VLOOKUP(A2,$M$2:INDEX($P$1:$P$1000,A3),2,FALSE)

  5. #5
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup changing array

    One way could be this.

    Type in a cell(let;s say in M1, the cell that tour range wants to end. Example P1000.

    Then use this.

    =VLOOKUP(A2,$M$2:INDIRECT(M1),2,FALSE)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  6. #6
    Forum Contributor
    Join Date
    08-22-2011
    Location
    Texas, United States
    MS-Off Ver
    Excel 2007 and 2010
    Posts
    516

    Re: Vlookup changing array

    zbor, that worked perfectly!

    Thanks so much!

  7. #7
    Registered User
    Join Date
    06-19-2012
    Location
    N/A
    MS-Off Ver
    Excel 2007
    Posts
    46

    Re: Vlookup changing array

    Please Login or Register  to view this content.
    If I have helped, please click the star below.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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