+ Reply to Thread
Results 1 to 4 of 4

HLookup formula

  1. #1
    Registered User
    Join Date
    10-15-2008
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    93

    HLookup formula

    Hi there
    Following is an example of an HLOOKUP formula I'm using:

    =HLOOKUP(A1,$B$2:$E$5,4,FALSE)

    The problem I'm having is that if a user inserts a row within the range B2:E5, then it throws my lookup formula out, because the formula should now be looking at row 5 and not row 4. How do I get the number 4 in the formula to be a variable that always selects the last row of the specified (variable) range?

    Thanks!
    Sunil
    Last edited by VBA Noob; 10-26-2008 at 05:38 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    =hlookup(a1,$b$2:$e$5,row(a5)-1,false)

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481
    Try,

    =HLOOKUP(A1,$B$2:$E$5,ROWS($B$2:$E$5),FALSE)
    Cheers
    Andy
    www.andypope.info

  4. #4
    Registered User
    Join Date
    10-15-2008
    Location
    Sydney
    MS-Off Ver
    Excel 2007
    Posts
    93
    Thanks for the replies - I tried Andy's versions....worked a treat!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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