Comments on: How to extract number from string in Excel

To extract number from string in Excel, it'd take a little ingenuity, a bit of patience, and a bunch of different functions nested into each other. Or, you can run the Extract tool and have the job done with a mouse click. Continue reading

Comments page 8. Total comments: 577

  1. Thanks for the formula - it works, and it's going to save me a ton of time!

  2. Dear
    for example : 25,20,15,25,300,40 is it possible to extract the numbers before "g",
    Ali Baba Dark Chocolate 25 gm box 12 pcs
    Ali Baba Dark Chocolate 20gm*24 box
    Cadbury 5 Star White Chocolate 15gm
    Kinder 2 White Chocolate 25 gm*24
    ALpella Biscuits W/Marshmallow300gm
    Alpella Chocolate 40gm
    plz let me know the formula

    1. Hello!
      If I understand your task correctly, the following formula should work for you:

      =CONCAT(IF(ISNUMBER(--MID(MID(A15, FIND("g",A15,1)-5,5),ROW($1:$93),1)), MID(MID(A15,FIND("g",A15,1)-5,5),ROW($1:$93),1),""))

      I hope it’ll be helpful.

  3. hi there,
    how do i extract any number before a decimal point using a formula.
    meaning 5569.9008 i only want to extract 5569. the formula has to be across for any types of decimals and combination numbers. thank you for the assistance.

    1. Hello!
      For decimal use the INT function

      =INT(A1)

      What is the combination numbers? Google does not know. Neither do I.

  4. I am wondering if this formula can be applied for address street number extraction, wherein the address line you have multiple numbers. For example:

    "Rua Hungria, 1240 – Jd. Europa | 1º andar" = 1240 & 1 = 12401

    And so, I was hoping for a solution to insert "-" between every occurring number. Thoughts?
    This is really great post! Thanks.

    1. Hello Krystian!
      I’m sorry but your task is not entirely clear to me. For me to be able to help you better, please describe your task in more detail. Please specify what you were trying to find, what formula you used and what problem or error occurred. Give an example of the source data and the expected result.
      It’ll help me understand it better and find a solution for you. Thank you.

      1. Hey Alex!

        I am using this formula:
        =SUMPRODUCT(MID(0&I25, LARGE(INDEX(ISNUMBER(--MID(I25, ROW(INDIRECT("1:"&LEN(I25))), 1)) * ROW(INDIRECT("1:"&LEN(I25))), 0), ROW(INDIRECT("1:"&LEN(I25))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(I25)))/10)

        And here is the example of raw data:
        R LEOPOLDO COUTO DE MAGALHAES JUNIOR, 758 - ANDAR: 15; CONJ: 151;

        Using the formula on the above example, I am getting this: 75815151 - concatenated numeric value of all numbers from the string. And, what I am hoping is to add a special character that would show the numbers like so: 758-15-151
        In short, on top of extracting the numbers, differentiate multiple numbers by some special character, "-" for example.

        Let me know if this is better. Thanks!

        1. Hello Krystian!
          You can use a custom format using the TEXT function

          =TEXT(A1,"###-##-###")

          where A1 is the cell with your formula.
          Or use your formula in the TEXT function

          =TEXT(SUMPRODUCT(MID(0&I25, LARGE(INDEX(ISNUMBER(--MID(I25, ROW(INDIRECT("1:"&LEN(I25))), 1)) * ROW(INDIRECT("1:"&LEN(I25))), 0), ROW(INDIRECT("1:"&LEN(I25))))+1, 1) * 10^ROW(INDIRECT("1:"&LEN(I25)))/10),"###-##-###")

          I hope this will help, otherwise please do not hesitate to contact me anytime.

          1. Hi Alexander, in my case I'd need it more dynamic. Raw data consists of multiple words and there are 2 numbers included. These numbers to be separated by a delimiter.
            Is it possible to create this formula without a specific pattern. That it simply extracts the numbers out of a text. no matter how long the text is and how long the numbers are. delimited by a special char such as blank or "-"? Thanks in advance for your help

            Example:
            client has ordered 500 pieces and wants to have 500 eur in return.
            desired result in cell with formula: 500-500

            client has exerciesed 500 and wants 3564656,32 new
            desired result in cell with formula: 500-3564656,32

            1. Hi,
              If I get you right:
              To extract numbers "500-500" from text "client has ordered 500 pieces and wants to have 500 eur in return",
              use the formula

              =SUBSTITUTE(TRIM(CONCAT(IF(ISNUMBER(--MID(A2,ROW($1:$94),1)), MID(A2,ROW($1:$94),1)," ")))," ","-")

              I hope this will help

              1. Dear Alexander,

                thanks for your hint. Issue is, that on my machine at work I am not allowed to install anything due administrator.

                So I hasd to replace the dots and commas by nothing. Then your formula worked well!!

                Thanks for your hint with your tool. Wil use it at home:-).

              2. Thank you in Sharing your "Learned Wisdom "

                We learn Every Moment even after the Physical Invisibility of ourselves.

                What is the Purpose of Learning if we choose not to share.

                Educate a Man" and Thou will Feed the Nations of the World.

                Blessings to You

              3. Dear Alexander, I just wanted to know how the formula could be adpated in order show the below. So if the first and or second number is with mentioning ofcomma/point.

                as with previous forumla it shows as below when comma/point are inside the numbers:
                500-008-356456-32

                raw data:
                client has exerciesed 500,008 and wants 3564656,32 new items

                desired result in cell with formula:
                500,008-3564656,32

                raw data:
                client has exercesed 500.008 and wants 3564656.32 new

                desired result in cell with formula:
                500.008-3564656.32

                thanks in advance for your help.

              4. Hello!
                You want to extract not only numbers, but also text. Comma and period are text. This cannot be done with a single formula. I was able to do this with Abledits Tools. First I used Convert Text (replace letters with spaces), then Trim Spaces (remove extra spaces) and again Convert Text (replace the space between numbers with a dash).
                You can install in a trial mode and check how it works for free
                If something is still unclear, please feel free to ask.
                You can ask a question on the blog or write to support@ablebits.com, include the link to your blog comment.

              5. Dear Alexander, thanks for your help on this. It works awesomly. Just had to perform SHIFT+STRG and ENTER in order to get the curly bracket around:-).Highly appreciated.

  5. very helpful but please make practice sample files available.

    1. Hi!
      You can find the practice sample workbook at the end of this tutorial under "Available downloads".

  6. I want o extract text from number like:
    1. 100Rte02T------RTet
    how can i do that by using formula

    1. Hello Learner!
      To extract all letters from text, use the formula

      =SUBSTITUTE((CONCAT(IF(NOT(ISNUMBER( --MID(A1,ROW($1:$93),1))), MID(A1,ROW($1:$93),1),"")))," ","")

      Hope this is what you need.

  7. This formula is working but the output is in form of exponential format. I am trying to remove GL code only, but it does not seem to be working.
    Here is the example:
    Resident Care:69000 · Wellness:69800 · Salaries and Wages:69890 · Payroll Taxes:69891 · FICA
    Resident Care:69000 · Wellness:69800 · Salaries and Wages:69890 · Payroll Taxes:69895 · FUTA
    Resident Care:69000 · Wellness:69800 · Salaries and Wages:69890 · Payroll Taxes:69897 · MI-UIA

    1. Hello!
      I’m sorry but your task is not entirely clear to me.
      For me to be able to help you better, please describe your task in more detail. Please let me know in more detail what you were trying to find, what formula you used and what problem or error occurred. It’ll help me understand it better and find a solution for you. Thank you.

  8. Hi Team,
    -6.135474.10.00.100012-AziziDevelopments-WO-1-73944857464-CONTR0067799835-Inet

    I want to extract only this portion "6.135474.10.00.100012" and some thing like that number from rest of data of 3000. Can anyone help me please with the formula.

    1. Hello Mayank!
      If I understand your task correctly, the following formula should work for you

      =LEFT(A1,SEARCH("-",A9,2)-1)

      I hope this will help, otherwise please do not hesitate to contact me anytime.

      1. Many Many Thanks Alexander. Will try to implement with this new formula.

  9. hi,
    Eg: One column 20Pcs Disposable Filter 3 Ply mask and another column 20
    how to find the same number exist in that string is correct?
    I have tried SEARCH option but is show only position. i want the exact number found in both the column is right/wrong?

    1. Hello!
      It is not clear what result you want to get. But maybe this formula is right for you.

      =IF(SEARCH(B1,A1,1)>0,"Right","Wrong")

      Hope this is what you need.

      1. thank you so much..

  10. THANK YOU SO MUCH THIS SAVED MY LIFE

  11. -6.135474.10.00.100012-AziziDevelopments-WO-1-73944857464-CONTR0067799835-Inet
    I want to extract only this portion "6.135474.10.00.100012" and some thing like that number from rest of data of 3000. Can anyone help me please with the formula.

  12. Hi All,
    Can you please help me extract this six digit number.

    clg:ramanlal/chennai/012345/April

    1. hello Nitin!
      To extract a 6-digit number from a mext, use the formula

      =MID(A1,MATCH(0, --ISERROR(-MID(A1,ROW($1:$99),1)),),6)

      I hope it’ll be helpful.

  13. what is the appropirate formula to find mid value (i.e. 602969) of FP:ADBL5-602969-2830 starting from "FP" among the spread sheet.

    1. Hello!
      If I understand your task correctly, please try the following formula:

      =MID(A1,FIND("-",A1,1)+1, FIND("-",REPLACE(A1, FIND("-",A1,1),1,""),1)+1 -FIND("-",A1,1)-1)

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  14. B264 80 0172760 STAINLESS STEEL HEX HEAD BOLT ASSEMBLY, 1/2" X
    What if I'm needing to pull only a seven digit number out of a string of text. I only need the 0172760 from the text. The problem I'm having is that the position of this seven digit number is not consistent from cell to cell and the previously mentioned formulas don't apply because they pull all digits, not just ones with a certain length.

  15. how can i extract set of 6 number form the below string
    "LBS 28 Marg, Bhandup West, Mumbai 400078, Maharashtra"

    1. Hello Vinay!
      To extract all numbers from text, use the formula

      =CONCAT(IF(ISNUMBER( --MID(A1,ROW($1:$93),1)), MID(A1,ROW($1:$93),1),""))

      I hope it’ll be helpful.

  16. Hi, could someone please help?
    trying to extract the size from the following:
    KIERRASTONE ASH TEXTURED ZKI2655A 300 X 600 X 9MM
    (300 X 600 X 9MM)
    i dont want the numebrs with the text (zki2655a) only the 300 X 600 X 9MM
    thanks look forward to your reply :)

    1. Hello Peter!
      If I understand your task correctly, the following formula should work for you:

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

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  17. Hi How do I find the MAX numerical value of the alphanumeric string? for example:
    X-0100
    B-0213
    F-0505
    Z-0111
    to show that F-0505 is the high value in the column

    1. Hello Kevin!
      If I understand your task correctly, the following formula should work for you

      =INDEX(A1:A5,MATCH("*"&LARGE( --RIGHT(A1:A5,LEN(A1:A5) - FIND("-",A1:A5)),1),A1:A5,0))

      If there is anything else I can help you with, please let me know.

  18. What would be the number if the invoice number has alphanumeric characters in the middle.
    Example:
    09187GH1234

  19. Hello, what formula can I use to pull and separate the last four sets of numbers in the following string?
    "CJFRO20190047 000 004 03/14/19 1906 JP MORGA JPMC 1st Qtr 0.00 0.00 0.00 -12.63"
    I used the first formula from above but it doesn't give me all the values.
    Any advice will be greatly appreciated.

  20. Thanks for this great solution. The formula given above ("How to get number from any position in a string")-> is work fine.

  21. What is a good formula to use in order to see numbers that are alike in any order? For example
    457. 885
    886. 275
    573. 547

  22. Below formula working fine but some number have percent sign between the text,i want extract number with percent sign which have % Sign as well.

    =IF(SUM(LEN(A2)-LEN(SUBSTITUTE(A2, {"0","1","2","3","4","5","6","7","8","9"}, "")))>0, SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2,ROW(INDIRECT("$1:$"&LEN(A2))),1))* ROW(INDIRECT("$1:$"&LEN(A2))),0), ROW(INDIRECT("$1:$"&LEN(A2))))+1,1) * 10^ROW(INDIRECT("$1:$"&LEN(A2)))/10),"")

  23. hi i have a cell from vendor quotes that i receive. this is how i name the vendor quote.
    Lighting Expression 11-20-19 ($132,833)
    Vendor name - date provided - dollar amount
    i want to extract only the dollar amount which can vary up to 2 million.

  24. How can add the numbers of this following examples, without sorting it fisrt
    CIVUS0.35B
    CIVUS1W
    IA-CIVUS0.13W
    TAVUS0.35SB
    AVSSF2W/B
    AVS3W/B

  25. The article was such Helpful that I got rid of a work that could have required me to dedicate lots of minutes. Thank you all.

  26. Thanks for the formulas (But I had trouble get them working. Here is why)
    In some countries, Sweden among them, the "," character is a decimal delimiter. There for "SEARCH({0,1,2,3,4,5,6,7,8,9},A2)" results in an error. So for us we have to use another character in the syntax, ";". So here is what worked for me:
    SEARCH({0;1;2;3;4;5;6;7;8;9},A2)

    Hope above saves some time for others!

    1. if character is more then 10 and less then 1000 which formula use

  27. =SUM(MID(0&A3,LARGE(ISNUMBER(--MID(A3,ROW(INDIRECT("1:"&LEN(A3)))*ROW(INDIRECT("1:"&LEN(A3))),1)),ROW(INDIRECT("1:"&LEN(A3))))+1,1)*10^(ROW(INDIRECT("1:"&LEN(A3)))-1))

    not getting any result if help if there is any error

  28. This formula does not give the decimal values i.e 5.25, 7.3 and more. Kindly help me out on this.

    Formula ,

    IF(SUM(LEN(A2)-LEN(SUBSTITUTE(A2, {"0","1","2","3","4","5","6","7","8","9"}, "")))>0, SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2,ROW(INDIRECT("$1:$"&LEN(A2))),1))* ROW(INDIRECT("$1:$"&LEN(A2))),0), ROW(INDIRECT("$1:$"&LEN(A2))))+1,1) * 10^ROW(INDIRECT("$1:$"&LEN(A2)))/10),"")

    1. =LOOKUP(9.9E+307,--LEFT(MID(A2,MIN(FIND({1,2,3,4,5,6,7,8,9,0}, $A2&"1023456789")),999),ROW(INDIRECT("1:999"))))

  29. While this was very very helpful, I am facing a new kind of problem.
    Job Id - #2416387528594195 is getting converted to '2416387528594190, excel is rounding off the last two digits and replacing with 0. Concat with an apostrophe also didn't help. I applied formula: =CONCAT("'",SUMPRODUCT(MID(0&B2,LARGE(INDEX(ISNUMBER(--MID(B2,ROW(INDIRECT("1:"&LEN(B2))),1))*ROW(INDIRECT("1:"&LEN(B2))),0),ROW(INDIRECT("1:"&LEN(B2))))+1,1)*10^ROW(INDIRECT("1:"&LEN(B2)))/10))

  30. Hey,
    Svetlana Cheusheva
    Thank you so much for the tutorial. It is very nice of you. It was very helpful to me.

  31. This formula is exactly what I was looking for... and it works perfectly. Thank you so much! ;-)
    =IF(SUM(LEN(A2)-LEN(SUBSTITUTE(A2, {"0","1","2","3","4","5","6","7","8","9"}, "")))>0, SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2,ROW(INDIRECT("$1:$"&LEN(A2))),1))* ROW(INDIRECT("$1:$"&LEN(A2))),0), ROW(INDIRECT("$1:$"&LEN(A2))))+1,1) * 10^ROW(INDIRECT("$1:$"&LEN(A2)))/10),"")

  32. Not sure how to extract check no’s. From a text string having more that one set of numbers - see example below:

    Brad James Company - Check - 23897 / invoice # 456755 issued Sept 1

    Any suggestions are greatly appreciated - the line above is a sample of the excel items and after the check number shown there a number of invoice numbers in the text string.

    Thanks , Fred

    1. If this is the data :
      My Assumption is that all your data has "/" after the check number.
      First :
      Find the nth place of that "/" in that string using this formula :
      =+FIND("/",D2)
      Brad James Company - Check - 23897 / invoice # 456755 issued Sept 1
      Output = 36
      then,
      use this formula =+MID(D2,C2-7,7)
      here D2 is the input data which you have & C2 refers to the output of find formula i.e)36
      then the output will be "23987".
      Hope this helps! :)

  33. The formula, of middle search doesnt fetch n give decimal place like 18.625

  34. Client Name
    LALITA
    GEETA DEVI NAYAK
    MEHARUN NISHA
    DIPA MANOJ
    PREETI SINGHAL
    meena devi swami
    RAJIYA BEGAM
    SHEHIDE
    TARAWATI
    BHATERI DEVI
    sheela devi
    JANKI DEVI
    SUNITA
    ALKA KANWAR
    JAITUN
    POOJA DEBI
    CHHOTI DEVI
    VIMLA DEVI
    manju devi tak
    MANJU
    MUNNI DEVI
    GEETA DEVI
    TULSI DEVI
    AILARAKHI
    MUMTAJ BIBI
    How to Find MID name if mid name more than 3 Character

    1. =IF((LEN(A2)-LEN(SUBSTITUTE(A2," ","")))>1,MID(A2,FIND(" ",A2,1)+1,SUM(FIND(" ",A2,FIND(" ",A2,1)+1),(FIND(" ",A2,1)+1)*-1)),"")

  35. Ram mobile no-9925923457. Resides In Noida 119961
    Can You suggest How To find Phn no. From Above Text

    1. According to your para, find the number first, once you get all the numeric, then take the left 10 digits, using the left formula.

  36. This is a great post.
    thank you so much for your effort here. I wish my company wasn't so tight in the pockets so I could get all those add-ins

  37. Hi,
    This is very helpful.
    One thing, the SUBSTITUTE(A2,{"0","1","2","3","4","5","6","7","8","9"},"") doesn't seem to be working for me. It is not replacing the characters with empty string.
    Data in cell A2: 25R
    Expected: R

  38. I meant, how do I get the last method (extract from anywhere) to preserve leading 0's? Thanks.

  39. This was immensely helpful, thanks. How do I get it to preserve any leading zeroes?

  40. Hey,
    Svetlana Cheusheva
    Please tell me how I can make a live input cell that is
    "Underlying Index: NIFTY 11907.30 As on Jul 03, 2019 10:05:20 IST" in B1 CELL

    to another cell say in C1 11907.30 and time in C2 10:50:20 to another cell.
    or at least I can print C1 that would be also sufficient.

    mainly viewed all the comment but not able to figure the amount

  41. I have a cell with a string of ISBN numbers separated by a bar. I am trying to extract the first number that contains 13 digits and begins with 978.

    0008234159|0008234167|0062678418|0062791451|006279955X|9780008234157|9780008234164|9780062678416|9780062791450|9780062799555
    The above numbers are in one cell. I need the first one that starts with 978 and contains 13 digits. I can easily do a right function with there are only two and the second is the one I need. Many times this doesn't work.

  42. How to separate the text and no. from string like this:
    Where hand power only is used 97.30 166
    Where any mechanically driven machinery is used 121.60 761
    Fish Dehydrating - 24.30 717
    Excl. erection, decoration tents and mosques 12.15 55 167
    Incl. Erection 24.30 168
    Floorcloth Linoleum Mfgrs. 30.15 725
    Flour and Dal Mills 15.10 169

  43. hello cen somebody please write me code for extract last 4 digits (0470) before P in serila number 1908910470P46363902R77391

    1. Hi Aljaž,

      Try this formula, where A2 is the serial number:
      =MID(A2, SEARCH("p",A2) - 4, 4)

      1. Hi Svetlana,
        Thanks for the tip but when you write a formula to my table, it return error.
        Any suggestions?

        1. Ok, I found problem. , needs to be swich for ; and then it works correctly.

  44. In a excel i have to add numbers from 2 different cells, 1st cell to have number before the decimal point and the other cell to have numbers after the decimal point.
    however both cells are linked to sheet 1 from which the cell number changes upon the entry, For example
    First Cell would be on D6 which is 10.25
    Second cell would be on O6 which is 6.77
    but the answer in cell E6 would be 10.77

    Can anyone help me with this please.

  45. hi
    i have 234598 number
    i want per number put on a cell
    234598 2 3 4 5 9 8

  46. I have serial number in a cell like 12345678910 and i want to some this in a different cell so how can i do this?
    plse help me 8127701024 this is my whatsapp number so pls help me

  47. i need to multiply:
    40,000 sq.ft of gross building area @25.00/sq.ft

  48. Hi I need some help!

    I have cells that include an inconsistent title but all include a 6-digit meeting code. is and some of the inconsistent titles have numbers before the 6-digit code. Any thoughts?

    What I have:
    146761 - Trane Extended Leadership Meeting - April 2015
    RFPIGR19 - 161291 - Society of Women Engineers 2019 National Conference - November 2017
    RFPIGR19-161791-IWD Q1-QOR Reviews

    What I need:
    146761
    161291
    161791

  49. DATA
    (A) 10400 OFF WHITE (B) 23100 CAMEL (C) 23100 CAMEL + 10400 WHITE
    NEED OUT PUT
    10400,23100,23100,10400
    Please help me !

  50. Anyone please,
    How can I extract the qty/value which is between texts. (e.g. 260 Individual Removal of Trees,small 303.00 each) I need to extract the number 303 only.) Thanks.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)