+ Reply to Thread
Results 1 to 8 of 8

Hlookup

  1. #1
    Registered User
    Join Date
    04-26-2014
    Location
    Utah
    MS-Off Ver
    Excel 2311 Build 16.0.17029.20028 64 bit
    Posts
    52

    Hlookup

    IFERROR(HLOOKUP(D22,D6:H19,14,TRUE),"Value Not Found")

    With the 'range lookup' set to 'TRUE', I expected the HLOOKUP formula to find the closest value to the 'lookup value' and return a value according to the 'row index' which is the year.

    Please see the attached spreadsheet.

    Example 1. The 'lookup value' is $400,000 and it does not find a value closest to $400,00.00 even though the 'range lookup' is set to 'TRUE' which is designated as an approximate value.

    Example 2. As expected, the formula renders the correct year if a value of $500,000 is entered if $500,000 is in row one.

    Example 3. The value of $477,637.16 is entered in row 1 and it can't find the year, even though it is an exact match.

    What I want to happen is that the closest match to the entered dollar amount is looked for in row one and the year that dollar amount is achieved, or the closest match, is shown as the year.


    HLOOKUP.xlsx

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Hlookup

    With TRUE as the 4th argument in Hlookup,
    The data in the top row of the range MUST be sorted in Ascending order from Left to Right.
    But this is not the case in that book.

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Hlookup

    Two problems:

    - When using TRUE for the range lookup, the values on row 6 would need to be sorted ascending; and
    - the lookup value would need to be larger than the smallest value in row 6.

    Cheers,
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  4. #4
    Registered User
    Join Date
    04-26-2014
    Location
    Utah
    MS-Off Ver
    Excel 2311 Build 16.0.17029.20028 64 bit
    Posts
    52

    Re: Hlookup

    Thank you.

    So, it seems there is no way to use HLOOKUP to do this. The values in row 6 can't be changed.

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

    Re: Hlookup

    There's always a way. In J5 copied down (you could do this in a separate tab)

    =SMALL($D$6:$H$6,ROWS($A$1:$A1))

    In D23 copied right

    =IF(D22<$J$5, HLOOKUP($J$5,$D$6:$H$19,14,FALSE), HLOOKUP(INDEX($J$5:$J$9, MATCH(D22, $J$5:$J$9)),$D$6:$H$19, 14, FALSE))
    Does that work for you?
    Attached Files Attached Files
    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
    Registered User
    Join Date
    04-26-2014
    Location
    Utah
    MS-Off Ver
    Excel 2311 Build 16.0.17029.20028 64 bit
    Posts
    52

    Re: Hlookup

    Yes, this worked fine.

    What do the $ do to the formula?

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

    Re: Hlookup

    A $ in an Excel Formula is an anchor. If it's in front of a row number, that number won't change as you copy the formula into another row. If its in front of a column letter, that column letter won't change when you copy it to the left or right.
    For example,
    =A1 + $B$1 in cell C1
    if copied to C2
    =A2 + $B$1
    if copied to D4
    = B4 + $B$1

  8. #8
    Registered User
    Join Date
    04-26-2014
    Location
    Utah
    MS-Off Ver
    Excel 2311 Build 16.0.17029.20028 64 bit
    Posts
    52

    Re: Hlookup

    Thank you. I continue to be impressed by Excel and by the knowledge in this forum. I also appreciated the helpful attitude.

+ 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. HLOOKUP Help. HLOOKUP links to Drop down list problems
    By finalmike in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-02-2013, 07:08 PM
  2. HLookup
    By alinoor in forum Excel General
    Replies: 3
    Last Post: 10-09-2011, 12:32 PM
  3. HLookup
    By mikeM- in forum Excel General
    Replies: 28
    Last Post: 04-15-2011, 12:15 PM
  4. HLOOKUP in HLOOKUP, Base Estimate Table in Excel
    By gqdallas in forum Excel General
    Replies: 20
    Last Post: 10-19-2009, 01:41 PM
  5. hlookup #N/A
    By stacyjhaskins in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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