+ Reply to Thread
Results 1 to 18 of 18

FORMULA to Extract Specific Numbers in a text field

  1. #1
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    FORMULA to Extract Specific Numbers in a text field

    Hi...Definitely need help on this one.
    Do we have a formula on how to extract a specific set of numbers (loan number) on a group of text field. Usually the 1st 2 digits starts with 24 or 3 letters with TLC . Posted a sample below. Any help is greatly appreciated.

    Sample 1
    REF:20130813L1B78J1C000484 RELATED REF:TLC29292271 ID:001235737204 BNF BK: ID: PAYMENT DETAILS: TLC29292271 RTN SNDRF TLC29292271 DD13AUG13 UTA INVALID ACCOUNT

    Sample 2
    WIRE TYPE:WIRE IN DATE:081313 TIME:1129 ET TRN:2013081300162745 SNDR REF:G0132252494701 SERVICE REF:273692 ID:000759569534 247526918 RICH EDMUNDS 26175770


    Sample 3
    WIRE TYPE:BOOK IN DATE:081313 TIME:1215 ET TRN:2013081300175615 SNDR REF:13813A5838QN0T53 SERVICE REF: RELATED REF: ID:001235737204 BNF BK: ID: per your request john c chapman loan 247111212

  2. #2
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: FORMULA to Extract Specific Numbers in a text field

    Assuming the numbers are always the same length (TLC is always 11 characters long and 24 is always 9 characters long) you can try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Don't just use the answers provided for you. Try to understand how it works by reverse engineering or asking about it.

    Please mark the thread as [SOLVED] (Thread Tools->Mark thread as Solved) when answered.
    If you're happy with an answer given, please click the * under the person's name to boost their reputation.

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: FORMULA to Extract Specific Numbers in a text field

    Imagine Sample 1 Being in Cell A1 - Put this in B1.

    =MID(A1,IFERROR(FIND("TLC",A1),FIND(24,A1)),(IFERROR(FIND(" ",A1,IFERROR(FIND("TLC",A1),FIND(24,A1))),LEN(A1))+1-IFERROR(FIND("TLC",A1),FIND(24,A1))))

    But this is error prone. For example if 24 if found earlier like in Sample 2, this is gonna mess it up.

    Looking for a better solution still.

    Deep
    Cheers!
    Deep Dave

  4. #4
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: FORMULA to Extract Specific Numbers in a text field

    Correction to my previous post's formula to incorporate some of what msexcel mentioned. try this instead:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Craig K. View Post
    Assuming the numbers are always the same length (TLC is always 11 characters long and 24 is always 9 characters long) you can try this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Appreciate your prompt reply Craig, the formula partially works especially on finding the set of number thats begin with "TLC"; however for the set that starts with "24" , its picking up earlier number that begins with 24 even if the length is not 9. As you can see on the sample below, when i run the formula its picking up 2494701 S first and NOT 247526918.

    WIRE TYPE:WIRE IN DATE:081313 TIME:1129 ET TRN:2013081300162745 SNDR REF:G0132252494701 S REF:273692 ID:000759569534 247526918 RICH EDMUNDS 26175770
    Last edited by Joshdm0716; 08-13-2013 at 03:13 PM.

  6. #6
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Craig K. View Post
    Correction to my previous post's formula to incorporate some of what msexcel mentioned. try this instead:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Craig, i tried but its still picking up early numbers that begins with 24. How about if we expand the search options, like numbers that begins with 3 digits, specifically " 244,245,246,247,248,249, 233"

  7. #7
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by msexcelathome View Post
    Imagine Sample 1 Being in Cell A1 - Put this in B1.

    =MID(A1,IFERROR(FIND("TLC",A1),FIND(24,A1)),(IFERROR(FIND(" ",A1,IFERROR(FIND("TLC",A1),FIND(24,A1))),LEN(A1))+1-IFERROR(FIND("TLC",A1),FIND(24,A1))))

    But this is error prone. For example if 24 if found earlier like in Sample 2, this is gonna mess it up.

    Looking for a better solution still.

    Deep

    yes, your right. its picking up earlier sets of numbers that beings with 24. can we instead expand the search options that begins with 3 digits. 244,245,246,247,248,233

  8. #8
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: FORMULA to Extract Specific Numbers in a text field

    Your wire messages aren't uniform which is causing a bit of a problem (by the way, posting wire messages online are a big no-no for financial institutions)

    try this then
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Craig K. View Post
    Your wire messages aren't uniform which is causing a bit of a problem (by the way, posting wire messages online are a big no-no for financial institutions)

    try this then
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It Works!! Thank you so much Craig, you are awesome!

  10. #10
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: FORMULA to Extract Specific Numbers in a text field

    Glad I could help.

  11. #11
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Craig K. View Post
    Glad I could help.
    Craig, Follow-up question, im showing some " #VALUE" errors on some. Looks like if a "/" sign preceded the number that i need to extract then im getting the "VALUE". See sample below. Do we have something to go around with this.

    Sample:
    TIME:1216 ET TRN:2013081300176153 SNDR REF:20132250264300 SERVICE REF:20130813L1B78J1C000945 RELATED REF: ID:3004240000 ORG BK: ID: INS BK: ID: SND BK: ID:122241255 BNF BK: ID: PAYMENT DETAILS: NEGATIVE FUNDING [B]/247287250 [/B]CHENG BEGIN 1363 12195 349 5447473 790692 8N END #N/A
    Last edited by Joshdm0716; 08-13-2013 at 05:08 PM.

  12. #12
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: FORMULA to Extract Specific Numbers in a text field

    Just add the condition to the formula I gave you. Like this
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Craig K. View Post
    Just add the condition to the formula I gave you. Like this
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Craig, can we expand your formula to include the "#" preceded the number.

  14. #14
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211

    Re: FORMULA to Extract Specific Numbers in a text field

    Try this version:


    =IFERROR(MID(A1,SEARCH(" TLC",A1)+1,11),MID(A1,LOOKUP(1E+99,SEARCH({" 24","/24","#24"},A1)+1),9))

  15. #15
    Valued Forum Contributor
    Join Date
    10-10-2012
    Location
    New York
    MS-Off Ver
    Excel 2007/2010
    Posts
    337

    Re: FORMULA to Extract Specific Numbers in a text field

    Do what Mama says!

    Sorry I didn't get back to you yesterday, but I don't log onto this site when I'm at home.

    @Mama - I was trying to originally build what you did but never thought to bring in the LOOKUP() function. Questions for you though, Does a function that does not use an array argument (like SEARCH()) need to be used within another function that does require an array argument (like LOOKUP()) to be able to work? what does the 1E+99 argument do within the LOOKUP() function? It's the only part I don't understand. Thanks.

  16. #16
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Thank Thank you Dear Mama!!

  17. #17
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Craig K. View Post
    Do what Mama says!

    Sorry I didn't get back to you yesterday, but I don't log onto this site when I'm at home.

    @Mama - I was trying to originally build what you did but never thought to bring in the LOOKUP() function. Questions for you though, Does a function that does not use an array argument (like SEARCH()) need to be used within another function that does require an array argument (like LOOKUP()) to be able to work? what does the 1E+99 argument do within the LOOKUP() function? It's the only part I don't understand. Thanks.
    Thanks Craig!! you guys solved my problem! ....AWESOMENESS TO YOU BOTH!!

  18. #18
    Registered User
    Join Date
    08-29-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: FORMULA to Extract Specific Numbers in a text field

    Quote Originally Posted by Teethless mama View Post
    Try this version:


    =IFERROR(MID(A1,SEARCH(" TLC",A1)+1,11),MID(A1,LOOKUP(1E+99,SEARCH({" 24","/24","#24"},A1)+1),9))

    Hi Mama,
    Just curios and like what Craig ask you, what is the use of 1E+99 argument in LOOKUP function.

+ 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. extract numbers from a cell, before a specific text
    By xlepws in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-11-2013, 01:46 PM
  2. [SOLVED] Formula to Extract Numbers from Text Cell
    By MHamid in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-03-2012, 04:08 PM
  3. Extract specific numbers from a string of text
    By Galwaygirl13 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-19-2012, 03:22 PM
  4. Need to extract field data from specific row
    By Yupyup in forum Excel General
    Replies: 2
    Last Post: 09-17-2012, 09:18 PM
  5. extract numbers with specific text from right or left
    By darkhangelsk in forum Excel General
    Replies: 2
    Last Post: 08-15-2009, 02:38 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