+ Reply to Thread
Results 1 to 7 of 7

Problem while using MID Function..

  1. #1
    Registered User
    Join Date
    11-23-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Problem while using MID Function..

    Hi everyone,

    Could you please lend some time to look into the below issue which I faced while using Mid function.

    Please find below my dataset:-

    Name+Surname+ID
    Rishabh-khanna$017293
    Shiv-Ramalingam$013553
    Arjun-Subhramaniam$014532

    My consultant asked to extract only surname from this column,So accordingly I tried by using Mid function, I was able to make it done at first cell, but in second cell it is showing some missing characters from surname as it exceeded the width of the character which I defined in the first cell.

    So please help me to figure it out either by using any other function into it. Be it Find Function or any other function. But please don't tell tell it by Alt+D+E i.e delimiting cell.

    Thank you all in advance!!

    Rishabh khanna

  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
    53,048

    Re: Problem while using MID Function..

    Hi and welcome to the forum

    Try this, copied down...
    =MID(A1,SEARCH("-",A1,1)+1,SEARCH("$",A1,1)-SEARCH("-",A1,1)-1)

    what this does, is start the "return by searching at 1 charactre past -
    SEARCH("-",A1,1)+1
    then tests to see how many characters we need, by calc'ing the difference of characters betweem $ and -...
    SEARCH("$",A1,1)-SEARCH("-",A1,1)-1

    Hope that helps?
    Last edited by FDibbins; 11-23-2013 at 04:42 PM.
    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
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Problem while using MID Function..

    =mid(left(a1,find("$",a1)-1),find("-",a1)+1,len(a1))

  4. #4
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 365
    Posts
    2,406

    Re: Problem while using MID Function..

    Deleted Post
    Azumi
    Last edited by azumi; 11-23-2013 at 11:51 PM.

  5. #5
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Problem while using MID Function..

    Or this

    =TRIM(MID(SUBSTITUTE(REPLACE(A1,FIND("$",A1),20,""),"-",REPT(" ",255)),255,255))

    And this

    =REPLACE(REPLACE(A1,FIND("$",A1),20,""),1,FIND("-",A1),"")
    Last edited by AlKey; 11-24-2013 at 12:18 AM.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  6. #6
    Registered User
    Join Date
    11-23-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Problem while using MID Function..

    HI all,

    Thanks for your support,, nice effort done.
    @alkey u are great ..

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Problem while using MID Function..

    You're welcome. Don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark thread as Solved).

+ 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: 6
    Last Post: 10-20-2013, 07:16 PM
  2. Problem Inserting Round function into an IF function
    By Ash87 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-11-2013, 05:37 PM
  3. IF function problem
    By bannister47 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-01-2011, 11:24 AM
  4. IF function problem
    By conks in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-24-2008, 11:21 AM
  5. LAN function problem
    By orvon in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 11-26-2006, 10:44 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