+ Reply to Thread
Results 1 to 10 of 10

Search column for text string and return row number

  1. #1
    Registered User
    Join Date
    03-09-2011
    Location
    Utah, USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Search column for text string and return row number

    I am looking for a formula to search for a text string from cells in one column within cells of another column in a separate sheet. I have two sets of data: Sheet1!C10:C1656 and Sheet2!G2:G2720. I want to see if each cell in Sheet1 column C exists as a string within cells of Sheet2 column G, and if so, return the corresponding row number. For example, Sheet1!C17 = "1587"; Sheet2!G643 = "1587 Skin Roast Flr Plan.pdf". The text string will not necessarily start in position 1. A formula would exist in Sheet1 column A, and result would be row "643".

  2. #2
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Search column for text string and return row number

    MATCH can do this when using "*" to "wildcard", like this:

    Please Login or Register  to view this content.
    see attached example file
    Attached Files Attached Files

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Search column for text string and return row number

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Search column for text string and return row number

    If you need the absolute row number, as opposed to the row within the search range:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by TMS; 01-19-2022 at 08:40 PM.

  5. #5
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Search column for text string and return row number

    @TMS, due to data starting on row 2, to return the row number, shouldn't the formula account for an offset with "+1"?
    like this:
    Please Login or Register  to view this content.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Search column for text string and return row number

    @janmorris: yes. See post #4

  7. #7
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: Search column for text string and return row number

    @TMS, haha, yes you beat me while i was typing. good solution

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Search column for text string and return row number

    I share your concerns about what may or may not be matched

  9. #9
    Registered User
    Join Date
    03-09-2011
    Location
    Utah, USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Search column for text string and return row number

    Thank you all, simple and effective solutions. I was trying to overthink it, and forgot about using wildcard with Match.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,364

    Re: Search column for text string and return row number

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 12-09-2021, 08:32 AM
  2. Replies: 2
    Last Post: 05-14-2015, 01:30 PM
  3. Replies: 2
    Last Post: 10-04-2014, 03:50 AM
  4. Replies: 3
    Last Post: 07-27-2011, 02:29 PM
  5. Replies: 1
    Last Post: 07-26-2011, 06:48 AM
  6. Replies: 3
    Last Post: 03-12-2010, 02:57 PM
  7. Search column - return row found in long text string
    By JayL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2005, 12:06 AM

Tags for this Thread

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