+ Reply to Thread
Results 1 to 8 of 8

Searching for a number within a text string

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: Searching for a number within a text string

    Brilliant, Thank you. If you get two mins could you explain how it works so i know for the future.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Searching for a number within a text string

    This part does most of the work:

    MIN(FIND(0,SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9},0)&0))

    it basically replaces each digit it finds in the string with a 0, so you will get a result of 9 variations of the text string.. It then adds a 0 to the end of each element so that the Find() function doesn't return an error...

    The Find() functions then finds the 0 in each of the elements and reports the position of the first 0 in each element..

    The Min() returns the smallest position location which would translate to the earliest point that the Substitute function replaced a digit with a 0.. which is, of course, the first time a digit occurs in the original string....

    This Min postion is then subtracted from the Length of the original string and 1 is added to determine how far from the Right to extract from.

    This returns a text version of your number... if you want to convert to an actual number add a +0 to the end of the formula.

    Note: To follow the evaluation go to Tools|Formula Auditing|Evaluate Formula and keep clicking Evaluate to follow the sequence of events leading to the final result.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Valued Forum Contributor
    Join Date
    04-21-2005
    Location
    Southern England
    MS-Off Ver
    Excel for Office 365
    Posts
    1,702

    Re: Searching for a number within a text string

    Thanks for your time once more. I never new about the forumla evaluation tool, it should help me in the future!

+ 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