+ Reply to Thread
Results 1 to 5 of 5

Hlookup negative number?

  1. #1
    Registered User
    Join Date
    10-26-2009
    Location
    san francisco, california
    MS-Off Ver
    Excel 2003
    Posts
    6

    Hlookup negative number?

    hi, I have a question using an Hlookup function. I was wondering if it was possible to find a number that is located in a cell above the "value" in the Hlookup formula?

    for example:

    1 2 3 4 5 6 7
    yes no maybe please haha monster 12 pk
    345 456768 76769 1234 12345 3456 345
    whhhha 234j 23jhk m34 9834 ok 234

    to find the header number associated with "monster" would I use
    =hlookup("monster",A1:G4,-2,False)

    I know that if I enter a 2 as the index_number it will show me the second value in that column BELOW monster, but I want to find the value ABOVE monster. is there a way to look up values above the it?

  2. #2
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Hlookup negative number?

    =index(A1:G1,match("monster",A2:G2,0))

  3. #3
    Registered User
    Join Date
    10-26-2009
    Location
    san francisco, california
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Hlookup negative number?

    awesome that helps so much! thanks.


    however, part 2 to this formula presents another problem to me. I dont want to manually enter the word for each value, rather I would prefer to have it refrence the list of values I need to look up. this is what it looks like in practice:

    in one column i have a list of values I need to look up:
    green
    red
    blue
    orange
    purple
    white
    black
    yellow

    then in another colum I have the formulas to look them up:
    =INDEX(CBU!A2:EH2,MATCH("green",CBU!A6:EH6,0))
    =INDEX(CBU!A2:EH2,MATCH("red",CBU!A6:EH6,0))
    =INDEX(CBU!A2:EH2,MATCH("blue",CBU!A6:EH6,0))
    =INDEX(CBU!A2:EH2,MATCH("orange",CBU!A6:EH6,0))
    =INDEX(CBU!A2:EH2,MATCH("purple",CBU!A6:EH6,0))
    ….
    …..
    ………
    …………


    is there a way to auto fill in these formulas with the next value in the list? the problem I get is that, because the index formula is looking up an "alphabetic word", simply entering "A1,A2,A3..." doesnt work. If I manually type in "red, blue, green, purple etc" it looks it up just fine. how can I automate this process?


    thanks

  4. #4
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Hlookup negative number?

    can you attach a sample???

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Hlookup negative number?

    It's not clear where you words are stored but let's say the words are listed in A1 onwards... then this

    =INDEX(CBU!A2:EH2,MATCH("green",CBU!A6:EH6,0))

    can easily become

    =INDEX(CBU!$A$2:$EH$2,MATCH($A1,CBU!$A$6:$EH$6,0))

    and be copied down for remaining rows.

    If you find the above is not giving you the expected results, ie #N/A! then the values you have in A1 onwards (ie green, red etc) are not the same as those used on CBU sheet - you may have leading / trailing spaces in your words in Column A in which case you must revise accordingly.
    Last edited by DonkeyOte; 10-27-2009 at 04:22 AM. Reason: typos

+ 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