+ Reply to Thread
Results 1 to 7 of 7

How do you create a dynamic HLOOKUP formula that returns a specific value?

  1. #1
    Registered User
    Join Date
    06-11-2013
    Location
    Vancouver, BC
    MS-Off Ver
    Excel 2007
    Posts
    4

    How do you create a dynamic HLOOKUP formula that returns a specific value?

    I need some help, this is my first time on this forum.

    I got as far as returning the value I wanted if there is data in my spreadsheet with my HLOOKUP formula, however I want to make it dynamic so that when I add a row of data I don't have to keep changing the formulas. Here is the formula I am using =IF(HLOOKUP($DB$6,$CM$1:$CZ$73,9,FALSE)>0,1,HLOOKUP($DB$6,$CM$1:$CZ$73,9,FALSE)).

    Thanks if anyone can help with this one it would be great.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How do you create a dynamic HLOOKUP formula that returns a specific value?

    Try taking out the row references.


    =IF(HLOOKUP($DB$6,$CM:$CZ,9,FALSE)>0, 1, HLOOKUP($DB$6, $CM:$CZ,9,FALSE))



    This formula looks weird to me. If you posted a desensitized copy of you workbook and show us, perhaps I can be sure in my suggestion.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How do you create a dynamic HLOOKUP formula that returns a specific value?

    HLOOKUP will search the values in the row CM1:CZ1 looking for an exact match, and if it finds one it will return the data from the 9th row in that matching column (because of your 9). So, I'm not sure why your table is defined as going down to row 73, and if you add more data below that then the data returned will still be from the 9th row.

    Nevertheless, you could change it to $CM:$CZ to use full column references.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    06-11-2013
    Location
    Vancouver, BC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How do you create a dynamic HLOOKUP formula that returns a specific value?

    thanks Pete, the column reference you referred to does not work to replace a row reference, I get an error.

    Any other suggestions would be appreciated.

    Linda

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,733

    Re: How do you create a dynamic HLOOKUP formula that returns a specific value?

    Ah yes, I tend to use VLOOKUP rather than HLOOKUP, and so you can remove the column references and have full-row references:

    $1:$73

    However, as I pointed out you will not get data beyond the 9th row unless you do something about the third parameter.

    Hope this helps.

    Pete

  6. #6
    Registered User
    Join Date
    06-11-2013
    Location
    Vancouver, BC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How do you create a dynamic HLOOKUP formula that returns a specific value?

    Thanks Pete - I think I need to rework my spreadsheet - that reference won't work either.

  7. #7
    Registered User
    Join Date
    06-11-2013
    Location
    Vancouver, BC
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How do you create a dynamic HLOOKUP formula that returns a specific value?

    Hi Jerry, thank you, I tried your suggestion to no avail. I need to rethink my entire spreadsheet, it's 1.5 years old, I've advanced since then, so think I need to rework to take advantage of pivots.

+ 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