+ Reply to Thread
Results 1 to 15 of 15

Is it possible to reference a dynamic range in a lookup formula?

  1. #1
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Is it possible to reference a dynamic range in a lookup formula?

    I have a vlookup formula that references the the data from the bottom up, however it runs extremely slow. I do not want to limit the formula to a smaller range (because this workbook will eventually become quite large). Is there some way I can referenced a dynamic range, or have the formula find the last record instead.
    This is the current formula:
    =IFERROR(LOOKUP(2,1/(EquipmentData!$B$3:$B$1048576=$G6),EquipmentData!$C$3:$C$1048576)&"","")

    The sheet its referencing is EquipmentData. The dynamic range of the C column for this sheet is called EquipmentList.

  2. #2
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Hi Nitefox,

    You might want to try setting the range (e.g. C3:C10) as a table, rename the table (e.g. equipmentlist) and use the table name in your range?


    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Pl see attached file.
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Is it possible to reference a dynamic range in a lookup formula?

    alvin, can a table be dynamic.
    kvsrin thank you for that sample, but I can't get my head around it. I couldn't get it to work for me.
    Is it not possible to simply reference a dynamic named reference I already have?

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to reference a dynamic range in a lookup formula?

    =IFERROR(LOOKUP(2,1/(EquipmentData!$B$3:$B$1048576=$G6),EquipmentData!$C$3:$C$1048576)&"","")

    The sheet its referencing is EquipmentData. The dynamic range of the C column for this sheet is called EquipmentList.
    Should work. You'll need another dynamic range for Column B because the two vectors have to be the same size.
    =OFFSET(EquipmentList,0,-1) should work
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Is it possible to reference a dynamic range in a lookup formula?

    If it helps I have another dynamic range already called Serialnums for column B.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Is it possible to reference a dynamic range in a lookup formula?

    What type of data is in the range?

    Is it text? Numbers? Could be both? Something else?

    This will define a dynamic range for TEXT entries:

    =$C$3:INDEX($C$3:$C$1048576,MATCH("zzzzz",$C$3:$C$1048576))

    This will define a dynamic range for NUMERIC entries:

    =$C$3:INDEX($C$3:$C$1048576,MATCH(1E100,$C$3:$C$1048576))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  8. #8
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Quote Originally Posted by Nitefox View Post
    alvin, can a table be dynamic?
    Yes, try:
    1. Select range with title row, e.g. A1:C20 where row 1 is your title (ps: this method needs to have a title row or it will create one automatically)
    2. Go to [Home] menu, click [Format as Table] and select your preference style
    3. The [Format As Table] dialog box will appear, make sure [My table has headers] is checked then click [OK]
    4. Once the table created, you shall see the [Design] menu appears. You can modify the table name to something else (if this is your first table, it will be named as "Table1"
    5. Assume the title for column B (i.e. cell B1) is "Serialnums", and title for column C (i.e. cell C1) is "EquipmentList" you can use =Table1[Serialnums] to refer to data range in your column B and =Table1[EquipmentList] to refer to data range in your column C
    6. As and when you add data to the table, the range will automatically increase

    ps: If you want to delete row/column in a defined table, you've to right-click on the cell and choose [Delete] > [Table Rows]/[Table Columns] and not just hit the delete button on your keyboard


    _______________________________________________________________________________________________________________________________
    1. Click on the * Add Reputation if you think someone helped you
    2. Mark your thread as SOLVED when question is resolved

    Alvin
    Last edited by alvin-chung; 12-27-2013 at 07:47 PM.

  9. #9
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Is it possible to reference a dynamic range in a lookup formula?

    If it helps I have another dynamic range already called Serialnums for column B.
    The two ranges need to be the same size. That's why I suggested using
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Is it possible to reference a dynamic range in a lookup formula?

    If you have already two dynamic ranges do you have problems with simply:
    =IFERROR(LOOKUP(2,1/(SerialNums=$G6),EquipmentList)&"","")
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  11. #11
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Thank you everyone for your input.
    Izanol, that formula worked, but it to runs extremely slowly.
    ChemistB, that formula doesn't seem to work. Its displaying a results from the B column instead of the C column.
    Tony Valko, they are text entries. Im not quite sure how to apply that formula to my needs. I also already have dynamic formulas for both the B and C column on the EquipmentData page.

  12. #12
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Is it possible to sort the data by the SerialNums column?

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Quote Originally Posted by Nitefox View Post
    Izanol, that formula worked, but it to runs extremely slowly.

    Tony Valko, they are text entries. Im not quite sure how to apply that formula to my needs. I also already have dynamic formulas for both the B and C column on the EquipmentData page.
    Ok, how did you define the named ranges SerialNums and EquipmentList?

    If both ranges contain TEXT entries then define them as follows:

    Name: SerialNums
    Refers to:

    =EquipmentData!$B$3:INDEX(EquipmentData!$B$3:$B$1048576,MATCH("zzzzz",EquipmentData!$B$3:$B$1048576))


    Name: EquipmentList
    Refers to:

    =EquipmentData!$C$3:INDEX(EquipmentData!$C$3:$C$1048576,MATCH("zzzzz",EquipmentData!$C$3:$C$1048576))


    Then your formula would be:

    =IFERROR(LOOKUP(2,1/(SerialNums=$G6),EquipmentList),"")

  14. #14
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Is it possible to reference a dynamic range in a lookup formula?

    Thanks Tony, that works but it to is running extremely slowly still. Im guessing it must be to do with the sheer number of records I have, and its only going to get bigger.
    I think I'm going to have to look into a way to do it with VB instead.

  15. #15
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Is it possible to reference a dynamic range in a lookup formula?

    OK, thanks for the feedback!

+ 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. Replies: 3
    Last Post: 11-27-2013, 09:58 AM
  2. Lookup formula against a dynamic range
    By andrewc in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-26-2013, 07:12 AM
  3. [SOLVED] Create Dynamic Column Lookup Reference based on Table Header
    By jeversf in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-22-2013, 12:49 PM
  4. Use Match or Lookup to create dynamic cell reference in VBA R1C1 formula
    By rmunsun1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-20-2012, 06:10 AM
  5. [SOLVED] Dynamic Range Reference, Varying Size of Range
    By cdiaz in forum Excel General
    Replies: 2
    Last Post: 06-30-2011, 02:49 PM

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