+ Reply to Thread
Results 1 to 20 of 20

Vlookup changing cell

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Smile Vlookup changing cell

    Hi everyone,

    I'd like to use vlookup with a table array that changes according to the month(the files are sorted according to the month).

    The changing month is no problem of course, what I'd like is to use vlookup with a table array that is based partly on a cell, for example:

    D8: Vlookup(D2,'G:\Collection Files\[$E$4.xls]Sheet1'!$A$3:$Q$220,7,0)
    D9: Vlookup(D2,'G:\Collection Files\[$E$4.xls]Sheet1'!$A$3:$Q$220,11,0)
    D10: Vlookup(D2,'G:\Collection Files\[$E$4.xls]Sheet1'!$A$3:$Q$220,13,0)
    D11: Vlookup(D2,'G:\Collection Files\[$E$4.xls]Sheet1'!$A$3:$Q$220,16,0)



    I have provided an example - results should be in cells D8:D11,

    Not sure where to start, would love any help on this matter.


    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    I'd like to use vlookup with a table array that changes according to the month(the files are sorted according to the month).
    how do you want to change the month name of the file

    you could use indirect , ( will not work on closed files - you need the indirect.ext to work on closed files )

    so in a cell you could put the month name part of the file name

    lets assume thats in cell A1 and as an example - just the word april (unless you want years and then the file needs to include years )

    = vlookup(B7, INDIRECT.EXT ( "G:\Collection Files\"&A1&" - (E4).xls",7,0)

    =VLOOKUP(A1, INDIRECT.EXT("'"&D3&"Excel\indirect\Indirect from workbook\[settings.xlsx]sheet1'!A1:B2"),2,0)

    Can you explain a little more on the
    "vlookup(B7,G:\Collection Files\"Month name" - (E4).xls,7,0)

    are you taking the value in E4 away ?
    Wayne
    if my assistance has helped, and only if you wish to , there is an "* Add Reputation" on the left hand side - you can add to my reputation here

    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Hi,

    I installed the indirect.ext not sure about how to apply your line of code here:
    =VLOOKUP(A1, INDIRECT.EXT("'"&D3&"Excel\indirect\Indirect from workbook\[settings.xlsx]sheet1'!A1:B2"),2,0)

    The files are arranged in this way: G:\Collection Files\2014\January.xls,February.xls,March.xls and so on
    in the same way I also have G:\Collection Files\2015\January,xls,February.xls,March.xls.

    What I would like is to combine the search using the year aswell so it would apply to years aswell.

    Regarding "vlookup(B7,G:\Collection Files\"Month name" - (E4).xls,7,0)
    It should be like this: vlookup(B7,'G:\Collection Files\2014\[January.xls]sheet1'!A$3:$E$220) where in column A are listed all the employee numbers and C would be the one im trying to pull.

    Thanks for the help (:

  4. #4
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    sorry about that - my example was for files I have as tests for this sort of application

    So if you put the month and year into two cells
    lets say A1 and B1
    A1 = January
    B1 = 2014

    then you use the indirect as follows
    indirect.ext ( "'G:\Collection Files\"&B1&"\["&A1&".xls]sheet1'!A$3:$E$220"

    so in vlookup

    =vlookup ( B7, indirect.ext ( "'G:\Collection Files\"&B1&"\["&A1&".xls]sheet1'!A$3:$E$220", 7, 0 )
    should do it
    BUT your range is A to E - so thats 5 columns , and so you cannot return column 7 without extending the range to be A to G

  5. #5
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Great Idea,

    Not working though returns an #REF statement.

    Although the Paths are correct.

  6. #6
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    can you attach two spreadsheets
    the master you are using vlookup in and one of the months files
    i can create the folders on my C drive and see if i get it to work
    and then all thats needed is the G changed to C

  7. #7
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Hi,
    Attached are the two spreadsheets.

    The columns to be drawn in the January File : D, F , H , J

    To be put into F16:F19 in the main file

    Thanks!
    Attached Files Attached Files

  8. #8
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    so this is working for me
    =VLOOKUP(B7,INDIRECT.EXT("'C:\Collection Files\"&E5&"\["&E4&".xlsx]Sheet1'!A$1:$H$14"),1,0)
    i chnage the sheet name to sheet1 as well in January file

    I had to change the range though - for some reason ,if i go to H15 - I then get the #REF errors

    E5 = 2014
    E4 = january

    no idea why the range cannot extend ??

    so i selected the cells and cleared contents A6 to M300 on january.xlsx


    and now it works
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    That did it, awesome job !

    Thanks a lot!

  10. #10
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    your welcome
    if my assistance has helped, and only if you wish to , there is a reputation icon * on the left hand side - you can add to my reputation here
    If you have a solution to your thread - Please mark your thread solved do the following: >
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  11. #11
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Unfortunately, Only works when the other workbook is open for some reason.
    When I close it it shows #REF, such a shame.

    Don't know why, should work on closed workbooks aswell.

    Any thoughts?

  12. #12
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    yes, it should do - I think its something to do with the way your work book is setup - as i had to clear cells to get it to work before

    indirect.ext - does work on closed workbooks

    I can try and have a look , but it took quite a while to find the need to clear cells - it maybe quicker to setup the sheets a fresh

  13. #13
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Okay, Interesting. Which cells did your clear?

    I'll try to create the file from scrath.

    Thanks.

  14. #14
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    see post #8

    so i selected the cells and cleared contents A6 to M300 on january.xlsx

  15. #15
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Okay so I did a sensitivity report.
    Turns out the problem is because of the max cell refrence - when I limit it to 200 for the first cell and 100 for the second cell - it works.

    Thanks!

  16. #16
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    strange, wonder what is going on there, i had similar issues , if i used range over row 15

  17. #17
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    Yeah strange,
    The problem is that the file takes a long time to calculate each time you input something.
    It's like the excel is searching the file every single time.

  18. #18
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    yes, it will do all the calculations as its a "volatile" i think the word is

    if you goto advanced you could turn off calculation and set to manual
    I think F9 does that too
    or F9 calculates and you could use that after all the data entered

  19. #19
    Registered User
    Join Date
    05-29-2012
    Location
    Dallas,Texas
    MS-Off Ver
    Excel 2010
    Posts
    58

    Re: Vlookup changing cell

    There is a way to solve this actually.
    =VLOOKUP(B7,INDIRECT.EXT("'C:\Collection Files\"&E5&"\["&E4&".xlsx]Sheet1'!A$1:$H$14",FALSE),1,0)

    IF you insert false after your array it will stop the manual calculations

    Hope this helps someone, as a lot of people seem to have troubles with this.

  20. #20
    Forum Expert etaf's Avatar
    Join Date
    10-22-2004
    Location
    Wittering, West Sussex, UK
    MS-Off Ver
    365 (Mac OSX) (16.83 (24031120))
    Posts
    8,732

    Re: Vlookup changing cell

    Thats intesting thanks for that

    I had ,0) for false in the vlookup()
    i was not aware of the false working in indirect()
    ##If a1 is FALSE, ref_text is interpreted as an R1C1-style reference.

    thanks for that

+ 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. Changing Vlookup into SQL
    By djblois1 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-24-2014, 04:12 PM
  2. [SOLVED] Changing CSE formula and changing Vlookup to Index Match
    By stockgoblin42 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-21-2013, 08:18 PM
  3. [SOLVED] Changing fill color of shapes based on changing cell value
    By Stefan1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2012, 10:33 AM
  4. changing cell color based on changing values
    By tvonbehren in forum Excel General
    Replies: 2
    Last Post: 09-16-2009, 12:33 PM
  5. Changing vlookup value in VB
    By benno87 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-30-2008, 08:08 PM

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