+ Reply to Thread
Results 1 to 3 of 3

Finding nth word in a range of cells containing text

  1. #1
    Registered User
    Join Date
    05-16-2016
    Location
    Luxembourg, Luxembourg
    MS-Off Ver
    Office 13
    Posts
    2

    Question Finding nth word in a range of cells containing text

    Hi there,

    I'm looking for a macro which would be able to find the nth word in a range of cells containing some text and for the cell containing that word to be selected.

    e.g. in this sheet:

    excel eg.png

    is it possible to use a macro to find the 20th word (counting row by row i.e. A1, B1, C1, A2, B2 etc.), and then select/highlight the cell which contains the 20th word?

    Thanks in advance
    Last edited by liblikas1990; 05-16-2016 at 05:48 PM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Finding nth word in a range of cells containing text

    Put this code into a standard code module, and use it like this for a worksheet function:

    =NthWord(A1:C7,20)

    or like this in VBA

    strW = NthWord(Range("A1:C7"),20)

    Please Login or Register  to view this content.
    To select the cell, you cannot use the function version, but this will do that:

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 05-16-2016 at 03:08 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    05-16-2016
    Location
    Luxembourg, Luxembourg
    MS-Off Ver
    Office 13
    Posts
    2

    Re: Finding nth word in a range of cells containing text

    That worked really well, thanks!

+ 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: 3
    Last Post: 11-06-2014, 01:00 PM
  2. Finding text to the right of a word in a cell.
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-11-2014, 12:47 PM
  3. Vlookup for finding parts of text in lookup range cells
    By brandnew22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-18-2013, 11:20 PM
  4. [SOLVED] Finding median of range of cells containing text and numbers
    By _hs_ in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-18-2013, 12:23 PM
  5. Finding the range of cells that contain specific text
    By WerdnaSbbig in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2012, 10:33 AM
  6. Finding Text In MS Word
    By tahir in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-13-2008, 09:22 PM
  7. Finding and selecting text in word from excel
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2006, 10:35 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