+ Reply to Thread
Results 1 to 8 of 8

Help with lookup function

  1. #1
    Registered User
    Join Date
    11-01-2012
    Location
    sydney
    MS-Off Ver
    Excel 2013
    Posts
    10

    Help with lookup function

    I'm looking to use the lookup function to find a text value (e.g. "product 1") which happens to be in say, cell A1, then scan across Product 1's row and return the first value which is not 0, within the range b1:k1. In the real function I can't specify which row to look across becauseI don't know which row Product 1 will appear, which seems to be making it much harder.

    I have very limited lookup knowledge so any help is appreciated.

    Thanks
    Last edited by zepp; 12-05-2012 at 11:50 PM.

  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: Help with lookup function

    Like so... see attached:
    _________________
    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
    Registered User
    Join Date
    11-01-2012
    Location
    sydney
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Help with lookup function

    Sorry, I mistyped.

    I meant to type: "I'm looking to use the lookup function to find a text value (e.g. "product 1") which happens to be in say, cell A1, then scan across Product 1's row and return the first value which is not 0, within the range b1:k1."

    So in your example sheet, it would look all the way down column A, find "cat" (out of any number of entries in column A, each of my sheets has a different number of entries), and then only look at the 10 number entries along the row of "cat" (even if there are more than 10) starting at b1 and ending at k1.

    Is this possible to do?

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

    Re: Help with lookup function

    Ok, to make this dynamic the search cell cannot be in the same column as the searched strings. So:

    1)Move the search cell to B1.

    2) Enter this array formula in C1:

    =INDEX(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10), MIN(IF(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10)>0, COLUMN(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10)), ""))-1)

    ...confirm the formula by pressing CTRL-SHIFT-ENTER to activate the array.

    That will limit the search to the columns B:K of the matched row.

  5. #5
    Registered User
    Join Date
    11-01-2012
    Location
    sydney
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Help with lookup function

    Excellent, works great!

    Thanks a lot!

  6. #6
    Registered User
    Join Date
    11-27-2012
    Location
    Arkansas
    MS-Off Ver
    Excel 2000
    Posts
    42

    Re: Help with lookup function

    I know this may be an annoyance but I was trying to understand this type of formula the other day for a projection sheet at work. Could you break down what the formula is doing for me?

    =INDEX(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10), MIN(IF(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10)>0, COLUMN(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10)), ""))-1)

  7. #7
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: Help with lookup function

    Quote Originally Posted by Rwilliams_09 View Post
    I know this may be an annoyance but I was trying to understand this type of formula the other day for a projection sheet at work. Could you break down what the formula is doing for me?

    =INDEX(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10), MIN(IF(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10)>0, COLUMN(OFFSET(INDEX($A:$A, MATCH(B1,$A:$A, 0)), , 1, , 10)), ""))-1)
    Don't worry that formula. It's a volatile and a mile long formula.

    Try this compact/non volatile version:

    =INDEX(B2:K99,MATCH(B1,A2:A99,),MATCH(TRUE,INDEX(B2:K99,MATCH(B1,A2:A99,),)<>0,))

    Ctrl+Shift+Enter, not just Enter
    Last edited by Teethless mama; 12-06-2012 at 11:08 PM.

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

    Re: Help with lookup function

    If that takes care of your original query, please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ 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