+ Reply to Thread
Results 1 to 6 of 6

How to use a lookup, hlookup

  1. #1
    Forum Contributor
    Join Date
    04-08-2009
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2003
    Posts
    228

    Angry How to use a lookup, hlookup

    OK, so I have a number of coloums with figures.

    What I want to say is:
    If the column is not 0 but is a number (1,2,3...) then look to the column heading and display that heading.

    Is that possible? Do I need a lookup for that one?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use a lookup, hlookup

    As I had asked previously, we need to see a sample setup to give an accurate reply... this can be interpreted in a variety of ways.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    04-08-2009
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2003
    Posts
    228

    Re: How to use a lookup, hlookup

    Sorry, it kept crashing when I tried to edit the last one.

    Ok, let me try again:


    heading1 heading2 heading3 heading4 heading 5
    0 0 0 5 0
    0 3 4 6 0
    4 2 2 0 0


    What I need is to say that:
    reading across the columns, when you hit a number, display that header in a cell, then when you reach 0 again, display that heading.

    So it would go for the examples above:

    cell1 cell2
    heading4 heading5
    heading2 heading5
    heading1 heading4


    Hope that explains things better.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use a lookup, hlookup

    Assuming your table is in A1:E4, then try:

    =INDEX($A$1:$E$1,MATCH(TRUE,INDEX(A2:E2>0,0),0))

    copied down to get where first non-zero item occurs per row.

    and

    =INDEX(INDEX($A$1:$E$1,MATCH(A9,$A$1:$E$1,0)):$E$1,MATCH(0,INDEX(A2:E2,MATCH(A9,$A$1:$E$1,0)):E2,0))

    where first 0 after occurs... copied down.

  5. #5
    Forum Contributor
    Join Date
    04-08-2009
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2003
    Posts
    228

    Re: How to use a lookup, hlookup

    Thank you,

    first formula works perfect, second formula is pulling back the header from the first 0, not the one after the 'numbers stop'

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to use a lookup, hlookup

    The second formula where A9 is .. depends on where you put the first.. sorry..forgot to mention it...

    see attached.
    Attached Files Attached Files

+ 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