+ Reply to Thread
Results 1 to 8 of 8

If cell contains text contained in a named range return the row number

Hybrid View

  1. #1
    Registered User
    Join Date
    07-13-2009
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    81

    If cell contains text contained in a named range return the row number

    This is probably a realy easy one for you guys but

    I have a row of data - if a cell contains a text string that is found within a specified named range I want to return the row number - is this possible?

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains text contained in a named range return the row number

    Hi,

    Do you mean the relative or absolute row number? For example, if, in the the range A6:A20, cell A9 met your criteria, would you want 4 or 9 to be returned?

    Perhaps you could post a workbook with an example and your desired result clearly outlined.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    07-13-2009
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: If cell contains text contained in a named range return the row number

    Quickly - the 9 would be the result I wanted

    I can post an extracct from the book if needed

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains text contained in a named range return the row number

    Thanks.

    And by "contains a text string" do you mean that the entire contents of the cell match one of the values in the Named Range, or just that some part of it does?

    For example, if your Named Range consists of 3 entries: "cat", "dog" and "mouse", would a cell containing "123cat456" be a valid match according to your criteria? Or must a cell contain precisely either "cat", "dog" or "mouse" for it to be considered a match?

    Regards

  5. #5
    Registered User
    Join Date
    07-13-2009
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: If cell contains text contained in a named range return the row number

    a valid match would have to be an exact match to the contents of teh named range

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains text contained in a named range return the row number

    =LOOKUP(2,1/(ISNUMBER(MATCH(A6:A20,Range1,0))),ROW(A6:A20))

    where Range1 is the Named Range in question, assumed to be either a single-row or single-column vector (and not, for example, a 2-dimensional grid).

    You don't say which row number should be preferred if there is more than one such match: this formula will return the last.

    Regards

  7. #7
    Registered User
    Join Date
    07-13-2009
    Location
    Bristol, England
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: If cell contains text contained in a named range return the row number

    Brillian - Thanks

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: If cell contains text contained in a named range return the row number

    You're welcome!

+ 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. Help with determining if selection is contained in local named range
    By MI223 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-10-2013, 02:20 AM
  2. [SOLVED] Return specific text if a different text is contained anywhere in a range of cells
    By ciayers in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2013, 05:54 PM
  3. Replies: 7
    Last Post: 01-24-2013, 06:55 PM
  4. [SOLVED] Return number of rows used in a named range?
    By Traziness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2012, 10:33 AM
  5. Replies: 2
    Last Post: 04-18-2009, 07:43 AM

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