+ Reply to Thread
Results 1 to 11 of 11

Identify the keyword length in the string

  1. #1
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Identify the keyword length in the string

    Hi All,

    I have a string in the excel where I need to identify the particular keyword in that string and find the length of the string position where it occurs. Please find the attached excel.

    Thanks
    Attached Files Attached Files
    Last edited by sathishkm; 07-12-2021 at 06:37 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Identify the keyword length in the string

    Try this...
    =IF(ISERROR(SEARCH(" at ",A2)),0,LEN(A2))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Re: Identify the keyword length in the string

    Result are coming wrong. Please check the attachment.

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,811

    Re: Identify the keyword length in the string

    Try this formula instead in B2:

    =IFERROR(SEARCH(" at ",A2)-1,LEN(A2))

    then copy down as required.

    Hope this helps.

    Pete

  5. #5
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Re: Identify the keyword length in the string

    Results are coming wrong.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Identify the keyword length in the string

    try

    =IFERROR(SEARCH(" at ",A2)-1,LEN(A2))

  7. #7
    Forum Contributor
    Join Date
    07-17-2012
    Location
    bangalore
    MS-Off Ver
    Excel 2007
    Posts
    461

    Re: Identify the keyword length in the string

    Result are coming wrong. Please check the attached excel
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Identify the keyword length in the string

    You are confusing us...

    =IFERROR(SEARCH(" at ",A2)-1,0)

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,426

    Re: Identify the keyword length in the string

    Try this:

    =IFERROR(FIND(" at ",A2)-1,0)

    Are you still using Excel 2007???
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  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,603

    Re: Identify the keyword length in the string

    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


  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Identify the keyword length in the string

    1. You have changed the 1st file you posted. I dont recall the rest of the values, but the 1st number you gave was definitely 48, not 40!! Please do not change the data you provide - if you need to change it, add a 2nd file.

    2. explain how you arrive at (the new value of) 40 when "at" starts at position 42 please

+ 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: 12
    Last Post: 02-07-2020, 03:51 AM
  2. [SOLVED] Length of string, not value related to string appearing in input box prompt.
    By ColdDay in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-23-2014, 05:32 PM
  3. [SOLVED] Shorten string length if exceeds 31 characters (max sheet name length)
    By r2fro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2014, 05:57 AM
  4. [SOLVED] Need to chck if a keyword is present in a text string and return keyword if yes
    By Jekaterina in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-16-2012, 05:55 PM
  5. Replies: 8
    Last Post: 09-27-2012, 10:46 PM
  6. [SOLVED] Translate form data into a text string and output that string into a preformated length
    By TJ Saulnier in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-19-2012, 03:58 PM
  7. [SOLVED] Formula to identify a keyword in all cells of a column
    By HTC in forum Excel General
    Replies: 3
    Last Post: 07-28-2005, 11:05 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