+ Reply to Thread
Results 1 to 5 of 5

Custom Function

  1. #1
    Registered User
    Join Date
    05-12-2005
    Posts
    4

    Custom Function

    I am trying to locate or create a function which reads the number from a string.

    The data in the cell is formatted as text in this fashion: Name-25

    I would like to return in a new cell just the value of 25. How might I go about this?

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996
    Both of these work:

    =MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),99)*1
    Confirm with [Enter]


    =--(MID(A1,MATCH(FALSE,ISERROR(MID(A1,ROW($1:$100), 1)*1),0),100))
    Confirm with [Ctrl]+[Shift]+[Enter]

    Does that help?

    Ron

  3. #3
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Good examples, Ron. Other options:

    =RIGHT(A1,LEN(A1)-FIND("-",A1)) will work for your example of 'name-25', and returns the value also as text.

    =RIGHT(A1,(LEN(A1)-FIND("-",A1)))*1 same as above, but make the result a numeral, not text.

    TEXT TO COLUMNS: If you have several cells in a single column and each uses the same separator between text and numbers (as in your example: a single dash) TEXT TO COLUMNS will work faster for you.

    The best answer will depend on the exact format of your data, how many cells and where they are in your worksheet.

    Try these or give us more info.

    Good Luck.

    Bruce
    Last edited by swatsp0p; 05-12-2005 at 04:54 PM.
    Bruce
    The older I get, the better I used to be.
    USA

  4. #4
    Registered User
    Join Date
    05-12-2005
    Posts
    4

    Thanks

    Thanks,

    This:

    =RIGHT(A1,(LEN(A1)-FIND("-",A1)))*1

    was exactly what I was looking for.

  5. #5
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Thanks for the feedback, it is always appreciated. Glad we were able to help.

    Cheers!

    Bruce

+ 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