+ Reply to Thread
Results 1 to 3 of 3

Distance between 2 words in a cell that contains a block of text

  1. #1
    Registered User
    Join Date
    03-04-2013
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Distance between 2 words in a cell that contains a block of text

    Hi,

    I have 10,000 cells each cell containing lots of paragraphs.
    I need to match a pattern from each of these cells like:

    if distance between word1 and word2 <= 3, then "yes"/"1"/"true" else "no"/"0"/"false"
    it'll be really helpful if the code can count the number of such matches in each cell. (there can be more than 1 such match)

    for example: if cell A1 contains: "the janitor cleaned the closet and started leaving home just when he heard a deafening sound. running towards the closet, the janitor slipped...."
    if word1 and word2 are "janitor" and "closet"
    B1: should show me 2. (or atleast "true")

    search and find are counting all the characters but not words.
    may be counting the number of spaces in between word1 and word2 would do.
    please help.

    Thanks.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Distance between 2 words in a cell that contains a block of text

    Hello chandu1382,

    Welcome to the Forum!

    When creating solutions for pattern matches, less is not more. You should post a copy of the workbook. This will provide a complete set of examples from which solutions can be developed and tested. In the long run, it will save you time.

    To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

    File Manger Picture
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-04-2013
    Location
    Kolkata, India
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Distance between 2 words in a cell that contains a block of text

    Hi,

    Sorry for the trouble.
    I have attached now.
    Column B contains the text blocks and the match result should come in Column C.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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