+ Reply to Thread
Results 1 to 11 of 11

Vlookup with a changing table array

  1. #1
    Registered User
    Join Date
    01-04-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    4

    Vlookup with a changing table array

    Hi,

    I would like to understand how to use vlookup for a certain scenario.

    The scenario is the following; based on a text reference e.g. "*debt*" that you know will appear between two other reference points "Total assets" and "total liabilities", how do you utilize vlookup / table array to look between these two other reference points.

    Simply fixing the table array to these reference cells does not work as every time I input data the line for the two other reference points will be differet I.e. row range is 46-58 on input 1, 86-95 on input 2 etc. I know how to use Match in order to obtain the row range every time the input data is changed, however I don't know how to incorporate this changing range within Vlookup.

    I have been trying the following:

    =vlookup("*debt*",H1:H2,3,False)

    Where Cell H1 has the line for the first matched reference and H2 has the second matched reference.

    Any help or assistance / thoughts would be much appreciated.

    Jon

  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
    53,048

    Re: Vlookup with a changing table array

    take a look at using index/match/match for this

    the syntax would be...
    =index(range to look in,row to look in,column to look in)
    which becomes...
    =index(range to look in, match(value to find, range to find it in, 0), match(value to find, column to find it in,o) the ,0 is to find an exact match

    it is hard for me to try and convert your vlookup to the index/match, but if you have a problem implementing this, perhaps it would be easier to help you if you uploaded a sample workbook, showing what data you are working with, a few examples of what your expected outcome would be, and how you would arrive at that (remove any confidential info if necessary).

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    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
    Registered User
    Join Date
    01-04-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Vlookup with a changing table array

    Thanks for your quick response.

    I have uploaded a sample sheet, the key is that the match items will always be in column A, however at different row numbers (depends on the input data), therefore the table array has to move as necessary. I have shown this in sheet 1 and sheet 2.

    Please let me know your thoughts on how to resolve this.

    Thanks,

    Jon
    Attached Files Attached Files

  4. #4
    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
    53,048

    Re: Vlookup with a changing table array

    index/match version...
    =INDEX($A$7:$B$20,MATCH("Debt",$A$7:$A$20,0),2)
    vlookup version...
    =VLOOKUP("debt",$A$7:$B$20,2,FALSE)

  5. #5
    Registered User
    Join Date
    01-04-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Vlookup with a changing table array

    I had tried these formula's previously, however they do not work for the following reason:

    As I am taking the data from a 3rd party for company A, company B etc; for company A, the cell A7 might = "Total Liabilities", however for company B it might be A16 = "Total Libailities, and the same for "Current Liabilities" (company A = A1, Company B = A12). This would result in the following scenario's:

    Company A Table Array = A1:A7
    Company B Table Array = A12:A16
    Company B Table Array...

    I do not know how to define a Table Array using a common reference of "Total Liabilities" and "Current Liabilities" to find a variable line number in Column A. Otherwise, I will need to manually assign the Table array range every time I Import the data.

    Thanks,

    Jon
    Last edited by jnicflo; 01-05-2013 at 03:30 PM.

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Vlookup with a changing table array

    could you show an example of where the above formulas do not work?
    in the meantime, maybe this is what you are looking for :
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hope this helps
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  7. #7
    Registered User
    Join Date
    01-04-2013
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Vlookup with a changing table array

    many thanks - this works and is really useful

  8. #8
    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
    53,048

    Re: Vlookup with a changing table array

    does it really matter what the range is, if you are looking to find the value of "Debt" (or any other criteria for that matter), just make the search range big enough to accomodate the longest list?

    =VLOOKUP("debt",$A$1:$B$1000,2,FALSE)
    =INDEX($A$1:$B$1000,MATCH("Debt",$A$1:$A$1000,0),2)

  9. #9
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Vlookup with a changing table array

    you are welcome


    Please remember to mark the thread as solved if you are satisfied with your solution :
    To mark thread "Solved", go to the top of the thread,click "Thread Tools",click "Mark as Solved"

  10. #10
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: Vlookup with a changing table array

    @ FDibbins
    I think OP may be concerned that the lookup would pick out the criteria from elsewhere in the list, restricting the range to between the two other criteria would minimize that possibility..

    your formulas are definitely the better (and faster) approach, as long as the array only has the "debt" criteria once..

  11. #11
    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
    53,048

    Re: Vlookup with a changing table array

    you may be right, dred, thannks

+ 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