Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

look-up "1" and return a text string

Latest post Wed, Sep 23 2009 10:22 AM by bgcm12. 5 replies.
  • Wed, Sep 23 2009 6:22 AM

    • bgcm12
    • Top 500 Contributor
    • Joined on Wed, Sep 23 2009
    • Posts 4
    • Points 52

    look-up "1" and return a text string

    Hello All,

    I am new to the forum and quite new to more complex functions in Excel. I have the following sheet:

    col1..col2

    bmo..3
    amd..1
    dmq..2
    smp..4
    epm..1

    I want to lookup the value "1" in col2 and return all the text strings in col1 that match.  So in this instance I would have the result "amd, epm"

    Is this something I could achieve with a vlookup?

    Thanks in advance,

    Ben

    Filed under:
    • Post Points: 21
  • Wed, Sep 23 2009 7:23 AM In reply to

    Re: look-up "1" and return a text string

    Add this ARRAY formula to a cell

    =IF(ISERROR(SMALL(IF($B$1:$B$20=1,ROW($A1:$A20),""),ROW($A1:$A20))),"",
    INDEX($A$1:$A$20,SMALL(IF($B1:$B20=1,ROW($A1:$A20),""),ROW($A1:$A20))))

    and copy down as far as you might need.

    Regards

    Bob

    • Post Points: 21
  • Wed, Sep 23 2009 9:09 AM In reply to

    • bgcm12
    • Top 500 Contributor
    • Joined on Wed, Sep 23 2009
    • Posts 4
    • Points 52

    Re: look-up "1" and return a text string

    Hi Bob,

    Thanks very much for the quick reply.

    I have exchanged the values B1:B20 for D2:D185 for the column holding my integer values and exchanged A1:A20 for A2:A185 which is the range holding my names.

    I have put the formula in D187 and copied down 185 cells.  However, they all come-up blank.

    Any thoughts?

    Thanks again,

    Ben

    • Post Points: 21
  • Wed, Sep 23 2009 9:30 AM In reply to

    Re: look-up "1" and return a text string

    Did you array-enter the formula, that is hit Ctrl-Shift-Enter after inputting the formula, not just Enter.

    Regards

    Bob

    • Post Points: 21
  • Wed, Sep 23 2009 10:15 AM In reply to

    • bgcm12
    • Top 500 Contributor
    • Joined on Wed, Sep 23 2009
    • Posts 4
    • Points 52

    Re: look-up "1" and return a text string

    I have now!  Thanks.

    That has improved the situation as the function is now return names, however not the correct number of names and not the right names.

    It is returning the names below the correct row.

    Thanks for all your help, I'll have a go at dissecting the formula and seeing where the problem lies.

    • Post Points: 5
  • Wed, Sep 23 2009 10:22 AM In reply to

    • bgcm12
    • Top 500 Contributor
    • Joined on Wed, Sep 23 2009
    • Posts 4
    • Points 52

    Re: look-up "1" and return a text string

    Ok,

    Changing A2:A185 to A1:A185 has now returned the correct names.

    Dragging the array function down gives the correct amount of names - got it!!

    Thanks a lot

     

    • Post Points: 5
Page 1 of 1 (6 items) | RSS
Copyright Excel User Group and the relevant contributors, 2010. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.