+ Reply to Thread
Results 1 to 12 of 12

Remove only numeric strings from a value in the cell

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Remove only numeric strings from a value in the cell

    Good morning everyone.

    I'm using Excel 2010.

    In a series of cells, all contained in a single column, I have some values that end with a numeric string. In practice, the value in the cell represent the name and surname of many employees, followed by an alphanumeric string that represents the employee ID number and consists of:

    space
    -
    space
    numeric string of variable length.

    Some cells are deprived of the numeric string. The full name and surname of the employee is of variable length.

    For example (these names are obviously fictitious):

    Robert Callaghan - 2246
    Alan Cornwall
    Elizabeth McCormick Addams - 1522

    I have to extract only the text string that is placed before the numeric characters and the character "-".
    I tried with the division of the text into columns, but as the name is of variable length I can't determine where I have to place the delimiter.

    Could anyone help me?

    Thanks in advance.

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Remove only numeric strings from a value in the cell

    =LEFT(A1,SMALL(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&" - "&1/17),1)-4)
    If you have your data in A1 Try the above
    assume that there is always " - " before number
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: Remove only numeric strings from a value in the cell

    =IF(ISERROR(FIND(" - ",A1)),A1,LEFT(A1,FIND(" - ",A1)-1))
    and copy down the column
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Turkey
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Remove only numeric strings from a value in the cell

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Remove only numeric strings from a value in the cell

    Quote Originally Posted by nflsales View Post
    =LEFT(A1,SMALL(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&" - "&1/17),1)-4)
    If you have your data in A1 Try the above
    assume that there is always " - " before number
    Thanks for the reply.
    Unfortunately, the formula does not work.

    I have my data starting from cell B2, and the Italian version requires me to correct some points.
    For example: "," shall be corrected to ";" and the names of the functions must be translated into Italian, but even if the translation is correct, the formula does not work yet.

    Perhaps I did not explain it properly.
    If this string exists in the cell: "Robert Callaghan - 2246", using the formula I want to get only "Robert Callaghan".

    Using your formula that does not happen.

    Surely I'm wrong. Could you explain better?

  6. #6
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Remove only numeric strings from a value in the cell

    Thank you all for the answers.

    Unfortunately, the formulas do not work. I explained in response to the user "nflsales" which is the problem.

    I can't understand what is the error that I commit.

  7. #7
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Turkey
    MS-Off Ver
    Excel 2013
    Posts
    159

    Re: Remove only numeric strings from a value in the cell

    I attached sample sheet
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Remove only numeric strings from a value in the cell

    Quote Originally Posted by Ali Kırksekiz View Post
    I attached sample sheet
    Wonderful!

    This is that I needed.

    Excuse me, but at first I thought it was a code of VisualBasic

    Thank you very much!

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Remove only numeric strings from a value in the cell

    Try this...

    Data Range
    A
    B
    2
    Robert Callaghan - 2246
    Robert Callaghan
    3
    Alan Cornwall
    Alan Cornwall
    4
    Elizabeth McCormick Addams - 1522
    Elizabeth McCormick Addams


    This formula entered in B2 and copied down:

    =TRIM(LEFT(A2;FIND("-";A2&" -")-2))

    You'll have to translate the function names if needed.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  10. #10
    Registered User
    Join Date
    09-21-2012
    Location
    Roma
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: Remove only numeric strings from a value in the cell

    Quote Originally Posted by Tony Valko View Post
    Try this...

    Data Range
    A
    B
    2
    Robert Callaghan - 2246
    Robert Callaghan
    3
    Alan Cornwall
    Alan Cornwall
    4
    Elizabeth McCormick Addams - 1522
    Elizabeth McCormick Addams


    This formula entered in B2 and copied down:

    =TRIM(LEFT(A2;FIND("-";A2&" -")-2))

    You'll have to translate the function names if needed.

    Thanks for your reply.
    I solved with the example of Ali Kirksekiz.

  11. #11
    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: Remove only numeric strings from a value in the cell

    English (US)

    =SUBSTITUTE(LEFT(B1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},B1&1/17))-1),"-","")

    Italian

    Translated formula

    =SOSTITUISCI(SINISTRA(B1;MIN(RICERCA({0;1;2;3;4;5;6;7;8;9};B1&1/17))-1);"-";"")

    Row\Col
    B
    C
    1
    Robert Callaghan - 2246 Robert Callaghan
    2
    Alan Cornwall Alan Cornwall
    3
    Elizabeth McCormick Addams - 1522 Elizabeth McCormick Addams
    Last edited by AlKey; 04-02-2015 at 10: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

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Remove only numeric strings from a value in the cell

    Good deal. Thanks for the feedback!

+ 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. [SOLVED] remove non-numeric characters from a cell
    By SWBodager in forum Excel General
    Replies: 17
    Last Post: 04-24-2015, 01:27 PM
  2. [SOLVED] remove everything between two strings in cell value
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-29-2013, 11:56 PM
  3. remove everything between two strings in cell value
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2013, 11:26 PM
  4. How to deal with different strings in a numeric field / cell
    By Hein in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2013, 07:23 AM
  5. remove all numeric data in a cell
    By darkhangelsk in forum Excel General
    Replies: 3
    Last Post: 01-25-2010, 03:31 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