+ Reply to Thread
Results 1 to 5 of 5

Help in cut string

  1. #1
    Registered User
    Join Date
    06-14-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Help in cut string

    Hi,

    I'm looking for a generic function that can help me cut a string from the whole string that varies.
    The string needs to be cut is A: monitor.task.A.B
    Notice that monitior.task will always remain the same while A and B are changing.
    E.g: monitor.task.vl_h.sql.0010
    monitor.task.djcat_hh.emailsub

    My idea is to cut the string between the second and third dot (.) but I don't know which function in excel can help me do it.

    Thanks for any help.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Help in cut string

    DaveNguyen,

    If the text is in A1:
    =MID(A1,FIND(".",A1,FIND(".",A1)+1)+1,FIND(".",A1,FIND(".",A1,FIND(".",A1)+1)+1)-FIND(".",A1,FIND(".",A1)+1)-1)

    Note: if the text string does not have three periods, the formula will return an error.

    Hope that helps,
    ~tigeravatar
    Last edited by tigeravatar; 06-15-2011 at 01:38 AM. Reason: Corrected formula

  3. #3
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Help in cut string

    Hello, Try also;

    =TRIM(MID(SUBSTITUTE(A1,".",REPT(" ",100)),200,100))
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  4. #4
    Registered User
    Join Date
    06-14-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Help in cut string

    Hi,
    Thanks for the help. All your functions works.
    As I said "monitor.task." remains the same, so I figured this myself:
    MID(A1,14,(FIND(".",A1,14) - 14))
    14 is the character right after the second dot (.)
    Cheers.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Help in cut string

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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