+ Reply to Thread
Results 1 to 18 of 18

Array parameters in different file

  1. #1
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Array parameters in different file

    Hello,

    I am having difficulty setting array parameters.

    I want to use a local cell from the spreadsheet to define the array in a different file I am pointing to.

    ie: I want "C32" and "D46" to be defined in my local spreadsheet.


    =(VLOOKUP(H$1,'C:\Users\ian.benoit\Desktop\DESKTOP\[QUICKBOOKS DATA.XLSX]Sheet1'!$C32:$D46, 2, FALSE))*1440

    Thanks in advance

    Ian

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Array parameters in different file

    You will need to use the INDIRECT function.

    INDIRECT evaluates its contents as a reference, instead of the string or other variables contained in it.

    So, if in C32 of your active worksheet you put A1 and then in D46 you out B10, you could used SUM(INDIRECT(C32&":"&D46)) to really evaluate SUM(A1:B10).

    Note how you need to still represent the colon, which is concatenated between the references with & and in quotes.

    In your example, you might use

    =VLOOKUP(H$1,'C:\Users\ian.benoit\Desktop\DESKTOP\[QUICKBOOKS DATA.XLSX]Sheet1'!&INDIRECT("$"&C32&":$"&D46), 2, FALSE)*1440
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    I am unsure if my syntax is correct, it does not appear to be accepting my algorithm.

    I used this :

    =(VLOOKUP(H$1,'C:\Users\ian.benoit\Desktop\DESKTOP\[QUICKBOOKS DATA.XLSX]Sheet1'!INDIRECT("$C"&C4&":$D"&D4, 2, FALSE))*1440

    As you can see, the columns (C and D) are always the same I am just change the row numbers.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array parameters in different file

    indirect needs to be the whole path, workbook like this
    =VLOOKUP(H1,INDIRECT("'C:\Users\acer\Documents\forum examples\[Book3.xlsx]Sheet1'!$C$"&C4&":$D$"&D4),2,FALSE)
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  5. #5
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    Thanks again for all your help!

    I still get a #ref error in this algorithm:

    =(VLOOKUP(H$1,INDIRECT("'C:\Users\ian.benoit\Desktop\DESKTOP\[QUICKBOOKS DATA.XLSX]Sheet1'!$C"&C4&":$D"&D4), 2, FALSE))*1440

    the value of C4:32
    D4:46

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array parameters in different file

    is the workbook open? indirect will not work on a closed workbook,

  7. #7
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    Yes quickbooks data.xlsx is open

  8. #8
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    I can post the files if you like!

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array parameters in different file

    well that works fine for me that is my actual path i also tried using INDIRECT.EXT() from the more func add in that works on closed workbooks
    http://www.thefreewindows.com/369/67...ons-for-excel/ (DONT KNOW IF IT WORKS IN 2010 THO)

    =VLOOKUP(H1,INDIRECT.EXT("'C:\Users\acer\Documents\forum examples\[Book3.xlsx]Sheet1'!$C$"&C4&":$D$"&D4),2,FALSE) and it works fine
    Last edited by martindwilson; 11-20-2013 at 12:12 PM.

  10. #10
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    The admin isn't in right now to give permissions to download those functions.

    I have attached the files I am using.
    Last edited by Benoot; 11-20-2013 at 08:51 PM.

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array parameters in different file

    =VLOOKUP(H1,INDIRECT("'C:\Users\acer\Downloads\[QUICKBOOKS DATA.XLSX]Sheet1'!$C32:$D46"),2,FALSE) works ok but if yo reference a cell

    =VLOOKUP(H1,INDIRECT(E18),2,FALSE) the leading ' is not seen so in effect it is looking at
    C:\Users\acer\Downloads\[QUICKBOOKS DATA.XLSX]Sheet1'!$C32:$D46
    and not
    'C:\Users\acer\Downloads\[QUICKBOOKS DATA.XLSX]Sheet1'!$C32:$D46 to fix that you have to add another one so the
    entry is in the cell as
    ''C:\Users\acer\Downloads\[QUICKBOOKS DATA.XLSX]Sheet1'!$C32:$D46

  12. #12
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    Your last post confused me a bit Martin,

    If you are looking at "quickbookstest1" The line I am attempting to work on is highlighted and reads:

    =VLOOKUP(H$1,INDIRECT("'C:\Users\ian.benoit\Desktop\DESKTOP\[QUICKBOOKS DATA.XLSX]Sheet1'!$C"&C4&":$D"&D4), 2, FALSE)*1440

  13. #13
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array parameters in different file

    =VLOOKUP(H1,INDIRECT("'C:\Users\acer\Downloads\[QUICKBOOKS DATA.XLSX]Sheet1'!$C"&C4&":$D"&D4),2,FALSE)
    works ok for me in quickbookstest1

  14. #14
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    Strange, I still get a #REF! error. It does not ask me to select the quickbooks data file after I input the function.

    I will try some more to figure it out.

  15. #15
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    I cannot seem to solve the problem, I keep getting #REF!. Could this perhaps be because my excel version is 2010?

  16. #16
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    I believe the problem is that once I start using INDIRECT() I don't select the other excel file I am pointing to once I close the function?

  17. #17
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Array parameters in different file

    Create a folder C:\TEST
    its then easier to test different things
    i can duplicate that file path and see if it works in fact this is working if i store
    QUICKBOOKS DATA.xlsx in c:/test ‎
    =VLOOKUP(H1,INDIRECT("'C:\test\[QUICKBOOKS DATA.xlsx]Sheet1'!$C"&C4&":$d"&D4),2,FALSE)
    see attached
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    11-19-2013
    Location
    Nanaimo, Canada
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Array parameters in different file

    thankyou. I ended up not using the whole path directory and it seemed to work. I only used [QUICKBOOKS DATA.XLSX]Sheet1'!

    instead of the whole C:\ path

    Thanks for your help!

+ 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. Can you pass parameters from a batch file to a macro?
    By kimberly_412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-14-2012, 07:11 PM
  2. Date Range: Array Formula with multiple parameters.
    By niceguy21 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-10-2012, 06:04 AM
  3. Array parameters?
    By Fat Al in forum Excel General
    Replies: 3
    Last Post: 02-08-2012, 03:01 AM
  4. Passing Array's As Parameters
    By chuckury in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2008, 10:08 AM
  5. Array Parameters as Variants Only
    By TheVisionThing in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-25-2005, 06:06 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