+ Reply to Thread
Results 1 to 23 of 23

Find specific Numbers in a cell with a lot of text

  1. #1
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Find specific Numbers in a cell with a lot of text

    Hello

    I have a fairly large excel about 1000 rows. The data source is unfortunately not very clean, meaning it was put in as free text. I need to find very specific 13 digit codes in one of the Columns for example in E: hsjjdalfiw 1234567891234 msbdjwkal. The problem is the number is not always at the same place, or the text around it is not always the same. Sometimes there is not even space around the number for example hfjdl-1234567891234, and of course the codes are always different numbers.

    Other examples:

    13th street,TX 1349203940123 MR Smith
    Mr Johnson, 1349203940123-BE-789, empresa JXD
    1349203940123, sdmeSD 6789 sdsd

    Is there any formula or any useful trick to extract only these 13 digit codes, so I dont have to do it all manually?

    Many thanks!

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    Hi there.

    A picture is worth 1,000 words. An Excel sheet is worth 1,000 non-editable pictures.

    Please read the yellow banner about sample worksheets, at the top of the screen. Act on its guidelines and post a SMALL sample sheet with REPRESENTATIVE data, an explanation and some expected results.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    Never mind... try this:

    =--LOOKUP(2,1/(MMULT(0+(ISNUMBER(-MID(" "&E2,ROW(INDIRECT("1:"&LEN(E2)))+{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14},1))+0={0,1,1,1,1,1,1,1,1,1,1,1,1,1,0}),{1;1;1;1;1;1;1;1;1;1;1;1;1;1;1})=15),MID(E2,ROW(INDIRECT("1:"&LEN(E2))),13))

    Check it out IN THE FILE... not by copy/pasting the formula from here.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Find specific Numbers in a cell with a lot of text

    If you don't mind to use array formula.

    If data in E6
    plase try this formula (follow with ctrl-shift-enter for array formula)
    =MAX(IFERROR(VALUE(MID(E6,ROW($A$1:$A$300),13)),0))

    Regards.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    Hahaha. Much simpler!!!!

  6. #6
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Find specific Numbers in a cell with a lot of text

    Thanks, Glenn.

    But I've got a question, if op want to get more than 15 digits of number, how to solve them?


    Regards.

    If I could use TEXTJOIN , I could use this formula .... T_T

    Data in E11 and follow with Ctrl-shift-enter
    =MID(E11,FIND(REPT("1",16),textjoin("",TRUE,IFERROR(IF(VALUE(MID(E11,ROW($A$1:$A$300),1))>=0,"1")," "))),16)
    Last edited by menem; 04-18-2022 at 06:17 AM. Reason: Got solution

  7. #7
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    Hi Glenn and hi menem,

    many thanks for your answer!
    I was mistaken and its 12 numbers and not 13. When I copy your formula, I always get the error message. Should I just subtract 1 number in your formula to change it to 12 numbers?

    I have attached a small sample.

    Again many thanks for your help and best regards!
    Sample.png

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: Find specific Numbers in a cell with a lot of text

    What happened when you tried this?

    =MAX(IFERROR(VALUE(MID(B3,ROW($A$1:$A$300),12)),0))

    Please get into the habit of providing workbooks instead of screenshots. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    If Ali's adaptation of menem's formula does NOT work... upload a FILE not a non-editable PICTURE of one.

  10. #10
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    Many thanks for your help,

    I have attached a small sample, if it is too small I can attach a larger one.

    Many thanks and best regards!
    Attached Files Attached Files

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: Find specific Numbers in a cell with a lot of text

    AliGW on MS365 Insider (Windows) 64 bit

    =MAX(IFERROR(VALUE(MID(A3,ROW($A$1:$A$300),12)),0))

    A
    B
    1
    2
    3
    Order: 4700270618, Projekt 149471-160923000013
    160923000013
    4
    Service and Maitance: Projekt 337611-180419001111
    180419001111
    5
    171962 - 200924000018 / Indoor LUKS Building 11
    200924000018
    Sheet: Tabelle1
    Attached Files Attached Files
    Last edited by AliGW; 04-20-2022 at 03:41 AM. Reason: Workbook attached.

  12. #12
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    luca. don't forget that the formula is an array formula and needs CTRL-HIFT-ENTER

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: Find specific Numbers in a cell with a lot of text

    That's true.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    Many thanks!

    A follow-up question:

    What if instead a 0 or just 4 numbers I want the cell to be empty, how would I have to adapt the formula?
    Also in my case I have 3 cells (attached the example), I would then at the end put in a cell where it looks for the 3 cells with the formula and just gives me the number in one cell.
    In the example cell G (final) VLOOKUP ?

    many thanks!!
    Attached Files Attached Files

  15. #15
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Find specific Numbers in a cell with a lot of text

    Please provide your desire result in G column (all rows).

    Regards.

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    A guess, based on menem's solution (and on my monster...).

    See file.
    Attached Files Attached Files

  17. #17
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    Hi Glenn,

    Awesome, many thanks!
    Could you help me with the formulas if instead a 12-digit number, I am looking for a 6 digit number?

    BR

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: Find specific Numbers in a cell with a lot of text

    Maybe:

    =IF(LEN(MAX(IFERROR(VALUE(MID(A3&C3&E3,ROW($A$1:$A$300),12)),0)))<12,"",MAX(IFERROR(VALUE(MID(A3&C3&E3,ROW($A$1:$A$300),12)),0)))

    =IF(LEN(MAX(IFERROR(VALUE(MID(A3&C3&E3,ROW($A$1:$A$300),6)),0)))<6,"",MAX(IFERROR(VALUE(MID(A3&C3&E3,ROW($A$1:$A$300),6)),0)))

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,099

    Re: Find specific Numbers in a cell with a lot of text

    See file.

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please select "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    Hi Glenn,

    You helpmed a while back with finding a 6 digit code.
    Now I want to find a 4 digit code and only in 1 cell - i tried to adjust your formula but just cant get it to work. Could you help me out?

    got to this:


    many thanks and best regards!

  21. #21
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    Dear Glenn,


    I just tried it again like this: =WENNFEHLER(--VERWEIS(2;1/(MMULT(0+(ISTZAHL(-TEIL(" "&H9;ZEILE(INDIREKT("1:"&LÄNGE(H9)))+{0\1\2\3\4\5};1))+0={0\1\1\1\1\1\1\0});{1;1;1;1;1;1})=6);TEIL(H9;ZEILE(INDIREKT("1:"&LÄNGE(H9)));4));"")

    Can you spot the error, I am making?
    Many thanks and best regards!

  22. #22
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,162

    Re: Find specific Numbers in a cell with a lot of text

    Attac a workbook!!!

  23. #23
    Registered User
    Join Date
    10-08-2021
    Location
    biel
    MS-Off Ver
    2019
    Posts
    38

    Re: Find specific Numbers in a cell with a lot of text

    see attachment

    My thinking was to take Glenn's Formula, that worked for the 6 digit codes and adjust it to 4 digits.

    BR
    Attached Files Attached Files

+ 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] Find a specific number inside a cell full of numbers
    By jimmygo33 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-05-2020, 11:52 PM
  2. [SOLVED] Find specific text within workbook's name, copy and paste it to specific cell
    By axtryo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-09-2017, 02:57 AM
  3. Find Numbers from a Cell with both numbers and text
    By Diichandran in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-30-2015, 10:15 AM
  4. [SOLVED] VBA to Find Specific Text, then Copy range to next open cell under specific text
    By Remotruker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2015, 10:59 AM
  5. Replies: 1
    Last Post: 09-11-2013, 12:12 AM
  6. Replies: 2
    Last Post: 08-05-2013, 07:32 PM
  7. Replies: 4
    Last Post: 05-12-2011, 04:37 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