+ Reply to Thread
Results 1 to 7 of 7

How to remove extra data from a cell

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    How to remove extra data from a cell

    Is there a formula to remove anything that follow the second space in a cell. For example, I have the following in cell A1, "Alex Hernandez Job#134 Department 124 Space 100". The formula will return just "Alex Hernandez". I know I can do text by column and delete the extra words, but some names only follow by Job#134 and some names follow by many more information. Thanks in advance.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: How to remove extra data from a cell

    Hi,

    =TRIM(LEFT(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),2*LEN(A1)))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    Re: How to remove extra data from a cell

    Thanks! Can you help me incorporate that function into this function that I wrote? =PROPER(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(F3, ",", " "), "-"," "), "H&W", "")))

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: How to remove extra data from a cell

    Not sure. Where should it go?

    Even better, why don't you explain what you're trying to do and give an example or two? You never know, there might be a simpler solution!

    Regards

  5. #5
    Forum Contributor
    Join Date
    05-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    184

    Re: How to remove extra data from a cell

    In cell A1, I have the following "H&W-MOLINA, TIMOTHY Job#103"
    I want to remove everything and return "Molina,Timothy" . Basically, the function I wrote was to remove all "commas" and "H&W", "-", etc and return "Molina Timothy Job#103". I want to write an additional function that would remove anything that is follow after Timothy. Thanks!

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: How to remove extra data from a cell

    But I take it this isn't a one-off exercise, to be performed just on that one string?

    If not, and so you need a solution which can work in multiple cases, what general statements can you make about where the extraction should take place?

    For example, is every case of the following precise format:

    H&W[a single hypen][some surname][a single comma][a single space][some first name][a single space][some random irrelevant text]

    and you want to return:

    [some surname][a single comma][a single space][some first name]?

    Regards

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: How to remove extra data from a cell

    For one single string example which you showed, the following formula will give you the desired output.
    Assuming your string is in F3, then

    Please Login or Register  to view this content.
    Last edited by sktneer; 08-30-2014 at 01:32 AM.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

+ 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. Remove extra data
    By carrolct in forum Excel General
    Replies: 4
    Last Post: 07-01-2014, 09:48 AM
  2. Remove extra space from the end of the cell contain text
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-31-2013, 09:55 AM
  3. Replies: 8
    Last Post: 08-27-2012, 04:37 PM
  4. Replies: 6
    Last Post: 06-12-2012, 07:50 AM
  5. Remove Extra Letters
    By day92 in forum Excel General
    Replies: 2
    Last Post: 01-20-2011, 07:20 PM

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