+ Reply to Thread
Results 1 to 6 of 6

Search array for text, return column #

  1. #1
    Registered User
    Join Date
    05-23-2006
    Posts
    58

    Arrow Search array for text, return column #

    Here is an example of what I'm trying to do:

    I have an array of cells with unique values: A1:Z1
    There is one cell where a search term is entered: B1
    I want: C1 = the column number where the term in B1 appears in A1:Z1.

    Thanks for any help.

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

    =Match(B1,A1:Z1,0)
    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 Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    Quote Originally Posted by NBVC
    Try

    =Match(B1,A1:Z1,0)
    Wouldn't that formula return 2 as an answer in all cases since it will just be matching itself?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by BigBas
    Wouldn't that formula return 2 as an answer in all cases since it will just be matching itself?
    Good point BigBas, I should've looked deeper into it.... Thanks.

    I would assume, user meant the lookup value is in B2 and result would be in C2:

    =Match(B2,A1:Z1,0)

  5. #5
    Registered User
    Join Date
    05-23-2006
    Posts
    58

    oops

    Sorry, I see where the confusion is. What my original post should have said is:

    Here is an example of what I'm trying to do:

    I have an array of cells with unique values: A1:Z1
    There is one cell where a search term is entered: A2
    I want: A3 = the column number where the term in A2 appears in A1:Z1.

    Match works great, thanks!

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Quote Originally Posted by Spreadsheet
    Sorry, I see where the confusion is. What my original post should have said is:

    Here is an example of what I'm trying to do:

    I have an array of cells with unique values: A1:Z1
    There is one cell where a search term is entered: A2
    I want: A3 = the column number where the term in A2 appears in A1:Z1.

    Match works great, thanks!
    In that case.... =Match(A2,A1:Z1,0)

+ 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