+ Reply to Thread
Results 1 to 12 of 12

Looking up a value in a defined table

  1. #1
    Forum Contributor michellepace's Avatar
    Join Date
    10-28-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    132

    Question Looking up a value in a defined table

    Hi there,

    I have two tables, TRADES and SPECS. From within my TRADE table I have this formula which looks up a value from a column in SPECS called "Margin":

    =VLOOKUP([@Future],SPECS,10,FALSE)

    Of course "Margin" is the 10th column in in my SPECS table... however, to make this forumula (or another if need be) more intuative to somebody reading it, I'd like to do something like this:

    =VLOOKUP([@Future],SPECS,margin,FALSE)

    Anybody have a solution how I can achieve something in using something more readable along these lines rather than just "10"?

    Thanks in advance,
    Michelle

  2. #2
    Forum Contributor michellepace's Avatar
    Join Date
    10-28-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    132

    Re: Looking up a value in a defined table

    The point being... in my SPECS table whilst I never rename columns, I often add or delete columns. If I have a static number, like 10, defined in my formula then I have to be very careful how columns are added to SPECS....

  3. #3
    Registered User
    Join Date
    12-22-2015
    Location
    Huntsville, AL
    MS-Off Ver
    2007
    Posts
    92

    Re: Looking up a value in a defined table

    Can you post the workbook?

  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
    52,929

    Re: Looking up a value in a defined table

    Hi Maichael hoe gaan dit, en waar in SA is jy? (SA ex-pat here from PE and Klerksdorp)

    I would probably do this with INDEX/MATCH instead.

    Seeing as you "add and delete columns" not sure you could still use a "word" to ID the column, but perhaps you could use MATCH() in a cell on it's own to create the column number, then give that a range name? This should work using VLOOKUP, too
    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

  5. #5
    Registered User
    Join Date
    12-22-2015
    Location
    Huntsville, AL
    MS-Off Ver
    2007
    Posts
    92

    Re: Looking up a value in a defined table

    FDibbins, couldn't she just refer to the column name in the formula?

    So if the column name is Margin, wouldn't =VLOOKUP([@Future],SPECS,[Margin],FALSE) work?

    That's what I had in my head anyway, and I wanted to try it out if she were to post an example.

  6. #6
    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
    52,929

    Re: Looking up a value in a defined table

    Quote Originally Posted by Cdubisms View Post
    FDibbins, couldn't she just refer to the column name in the formula?

    So if the column name is Margin, wouldn't =VLOOKUP([@Future],SPECS,[Margin],FALSE) work?

    That's what I had in my head anyway, and I wanted to try it out if she were to post an example.
    Good point. I dont like structured tables, so I try to avoid them - I need to change that view.

    Still, My approach should also work, but yours may be better

  7. #7
    Forum Contributor michellepace's Avatar
    Join Date
    10-28-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    132

    Question Re: Looking up a value in a defined table

    Hi FDibbins and Cdubisms, thank-you both for your replies.

    FDibbins, ek is goed. Maar we run out of water and electricity so ek is bly jy is in 'n ander plek! The borewors is still nice though. =)

    Cdubisms, your answer sounds exactly what I want and what made sense to me. Basically I'm trying to make my formula as intuitive and easy to understand as possible. However the formula you give does not seem to work.

    I've posted a work book for you both to show me what you mean. I've got a separate column for each of you =)

    I can't seem to attach the file to this thread, so I've posted it here for you: http://www.michellepace.com/Table_lo...out_index.xlsx

    Thanks again,
    Michelle

  8. #8
    Forum Contributor
    Join Date
    08-07-2014
    Location
    India
    MS-Off Ver
    2007
    Posts
    372

    Re: Looking up a value in a defined table

    Hi.

    Please find attached the file.please check and confirm.
    Attached Files Attached Files

  9. #9
    Forum Contributor michellepace's Avatar
    Join Date
    10-28-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    132

    Re: Looking up a value in a defined table

    Thank-you silambarasan, but your solution does not solve my question. Thanks for trying anyhow.

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Looking up a value in a defined table

    Hi Michelle,

    I think that, with structured referencing, an INDEX and MATCH approach may be the simplest:

    =INDEX(SPECS[Margin],MATCH([@Future],SPECS[Future],0))

  11. #11
    Forum Contributor michellepace's Avatar
    Join Date
    10-28-2015
    Location
    South Africa
    MS-Off Ver
    2013
    Posts
    132

    Lightbulb Re: Looking up a value in a defined table

    Hi xlnitwit,

    That's perfect! Thank-you

    Michelle

  12. #12
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Looking up a value in a defined table

    You are most welcome.

+ 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. Defined Name Table Refinement
    By Mojo Jojo 89 in forum Excel General
    Replies: 14
    Last Post: 11-12-2015, 12:20 PM
  2. Inserting subtotals into a defined table
    By CA_needing_help in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-20-2013, 09:23 AM
  3. [SOLVED] Run Time 1004 - App Defined or Object defined error with String defined path structure
    By sarails in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2012, 09:38 PM
  4. Table based on defined name, change defined name, how?
    By Dubrock in forum Excel General
    Replies: 0
    Last Post: 06-27-2012, 09:20 AM
  5. Application defined or object defined error when creating a Pivot Table
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2009, 05:05 PM
  6. Open and paste a .txt file to a pre-defined table
    By techtwa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2009, 06:20 AM
  7. export a non defined table as txt or cvs by VBA
    By snaggy^^ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2006, 10:25 AM

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