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 10. Total comments: 577

  1. 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.

  2. 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

  3. 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.

  4. 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.

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

  6. 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

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

  8. 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

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

  10. 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.

  11. Lb29235John033921058 this is in A1

    need formula for only "33921058"

    need just the last set of numbers but sometimes the count can vary in length so ex...
    last #s in a2 = 3 numbers
    last #s in a3= 5 numbers
    last #s in a4 = 9 numbers and so on

  12. AMANACDEDITA FLOW BACK 18.85G abcde
    RWK MIX DN/LAKA 4DSX12UNX135G

    These are two values in cells which i need value of "G" means number which are together with "G"

    Exa -1 = Input - AMANACDEDITA FLOW BACK 18.85G abcde so output would be - 18.85G because 18.85 is number with "G"

    Exa -2 = Input - RWK MIX DN/LAKA 4DSX12UNX135G so output would be - 135G because 135 is number with "G"

    Please Help.
    thanks

  13. Hello!
    "H004.16K6170" I need to get the number out of text include 0(left and right). for example "004166170"
    How can I do it? please help ;-;

  14. Hi,
    I have a 16 bit binary number in one cell, and have to read only 2 bit data from 5th position.Any excel formula for this?
    For Ex : 0100100001010011 is my bin number
    5th position counting from right is the 6th place(O,1,2,3,4,5)
    So it is 0, taking 2 bits to right is 01
    The answer is 01

  15. I have this column, where ALL is specified in other cells eg H1=270 and H2=9300
    ALL
    ALL
    8412
    319-3234
    8538-8542
    356
    2665

    And i would like to create this:
    A B
    270 9300
    270 9300
    319 3234
    8538 8542
    356 356
    2665 2665

  16. Hellow
    I would like to extract the number right before "days" from following an example. Could you help me?
    60 years, female, white, stage:iia, alive, 588 days
    female, asian, stage:iib, alive, 2759 days
    80 years, female, black or african american, stage:iia, alive, 3364 days

    I need
    588
    2759
    3364
    Thanks,

  17. Very helpful solved the problem.

  18. Hi, I have data like....agjkkhffjkkhfcnkkhfc2445543345fhhffh,
    I need only numbers like 244554334 pls help with formulas.

  19. Hi! I have "update" data in cells, like below (xxxx - string):
    181215 xxxxx xxxxx xxxx xxxx 34xx 3-4xxxx 181216 2xxxx-xx xxxx xx3 xxx, etc. where 181215 and 181216 are dates.
    I'd like to extract the last date (here it is 181216) from the string with functions (not with macro).
    Could you help me with this? Much appreciated! Thanks!

    PS: In the tutorial there's a little error at: =RIGHT(B2, LEN(A2)-B2+1). The working formula is =RIGHT(A2, LEN(A2)-B2+1) like under it.

  20. Thank you so much for this incredibly helpful article. The formulas almostttt work for me, but I am hoping to only retrieve the last 4 characters from a column entry ONLY in the case that the last four characters are NUMERIC, and even if there are numerals/text earlier in the string. My column entries are all different lengths so I am not able to use text to columns, either. Here is an example: If my column entry were to say "Blue Sky 1st Bracket 1999", I would only like to get the "1999" in its own separate column (without the inclusion of the first '1' earlier in the string). If my second column entry were to say "Blue Sky", I would like nothing to appear in the separate column. Thank you so much for your help.

  21. I NEED TO EXTRACT THE FOLLOWING ITEM
    DFG554GHFGHH

  22. How would I extract these numbers without using text to column, pleas, and thank you
    Introduction to IT 4 1
    Critical Thinking and Logic 3 1
    Fundamentals of Information Security 3 1
    Introduction to Geography 3 1
    Business of IT - Applications 4 2
    Integrated Physical Sciences 3 2
    Ethics in Technology 3 2

  23. I Want to Extract number after and before with X in the below descriptions
    example 1. Huhan Series XL38SX4 JP Limielite Product
    example 2. Shower Shampoo SM172SX1 BOX DENIM8 IN PC
    output want
    1. 38X4
    2. 172X1

    I need to extract 38X4 from the above string. I have bulk list of these type of description and the string type is not fixed. please help me to experts to extract these number in excel

  24. I have a lot of cells that looks like this:

    Omp. B. 2111215 013841 - Superbrugsens Lynge - Uggeløse fra sekr 935 52919 935 til sekr 935 52930 935

    And I need to find the number after the B., in this case 2111215. In some cells the number comes after "b" and some times after "B.". Is there any way to do this?

  25. Using the improved formula under the "How to get number from any position in a string" section, if a source string is "USEC-SATL: 100USRITM-SATL: 130", it will return "100130".
    Is there a way to adjust the formula so that it can return a comma separate value (i.e. 100,130)? I want to delimit it and get back the individual values. Thank you.

  26. Hi There,

    Please help me to get extracted the number from a string. There is a string "(CAN_39F Inc. - 35722)" and I want to get only "35722" instead of "3935722". I have used the formula given above but I get all the number written in the string. That formula is very helpful in getting number from strings like "(Meraki Group - 36785)" (extracted number "36785") but fails for strings where number is written middle of the string or start and I want only those number which are written in last after hyphen (-).

    Kindly help me to get this sorted out.

    That would be very helpful.

    1. Rahul:
      If the data is always formatted as shown in your example, the simplest way to extract the digits after the hyphen is:
      =RIGHT(A2,5) where the data is in A2. You can change the number of digits from 5 to another string length.

  27. Hello,

    I have query, I have data in cell like this
    "Owczarek TB 1, 2, Kobayashi T 2, Ramirez R 3, 4, Rong L 1, 2,3,4,5, Puzio-Kuter AM 2,". and I want to be split the data result like
    Owczarek TB 1, 2
    Kobayashi T 2
    Ramirez R 3, 4
    Rong L 1, 2,3,4,5
    Puzio-Kuter AM 2

    Please revert back me with solution.

    Regards,
    Kalyan

  28. HYE FRNDS
    I NEED A HELP
    Input erfsd9958405019e34
    Desired Output 9958405019

    1. Hello, Vishal:
      This formula will produce the desired output: =MID(A2,6,10)
      where the input is in cell A2.
      If you have the same need to extract the middle 10 digits beginning at the 6th digit then you can copy this straight down column A.

  29. HYE FRNDS
    I NEED A HELP
    INPUT LIKE THIS ( 98564, 45845, 45142, 45142)
    I WANT OUTPUT JUST SOME NUMBER LIKE (45845, 45142)

  30. Hello!
    I need to get last 6 numbers from a 10 digit number - 1000002502, but not including "0". Is there any formula with such condition?

  31. I have a question:
    I am trying to extend the autofill.

    I want it to go in sequence as A1+1, A2+1, A3+1, than A5+1, A6+1, A7+1, than A9+1 A10+1, A11+1...
    So when i drag the autofill it adds in above manner skipping after every 3 a cell

  32. Hello, Harsh:
    The data in the sample doesn't match the end result. Where is the data in the end result coming from?
    My first thought is you should try using the Text-to-Columns tool in Excel. Use the hyphen as the separator.
    If this doesn't work, try submitting your question with all the data so we can see what you're working with.

  33. Please help me for below data separation

    (Vehicle Number separation )

    - INV#7451-47KA03MF2980

    - SU081819WIN02420-OTC BILL

    (Vehicle number and Invoice number separation )

    - SU081819INS02152-KA03MZ2310-INS AMT

    Please do the needful..

  34. Please help me for below data separation

    (Vehicle Number separation )
    - INV#7451-47KA03MF2980
    - SU081819WIN02420-OTC BILL

    (Vehicle number and Invoice number separation )
    - SU081819INS02152-KA03MZ2310-INS AMT

    Please do the needful..

  35. Sudhir:
    There are a couple of techniques for extracting specific data from text strings.
    One method is to use the RIGHT, LEFT or MID functions. Another is to use Excel's Text-to-Columns tool and another is to use one of several formulae. All of the techniques are thoroughly explained and demonstrated with examples in the above article.

  36. Hi guys
    I want extract only numbers from
    e.g.
    Talk Show - (123456789)
    Pls pls share the formula.

    Thanks in Advance!

  37. how to extract the number of grams from a text like this without getting the 7x5 part
    BEAD GLASS LIGHT GOLD PIP 7X5MM PK30

    thank you

    1. Juana:
      Use the RIGHT function like this:
      =RIGHT(A2,2) where the text string is in A2.

  38. Tim:
    I can't get Excel to exhibit the behavior you're seeing, so I can't say how to correct it.
    The numbers are extracted as text. If that is a problem for you can use the VALUE function on those cells that contain the numbers stored as text. It looks like =VALUE(A2)
    Alternatively, you can use the text to columns tool in Excel, Use the fixed width option and it will separate the numbers from the text. This method produces the numbers as numbers. Even where you have large numbers of rows of data the Text-to-Columns tool gets the job done quickly.

  39. Hi guys,
    I refer to the formula to extract numbers from the beginning of the text string. i.e.,
    =LEFT(A2,SUM(LEN(A2)-LEN(SUBSTITUTE(A2,{"0","1","2","3","4","5","6","7","8","9"},""))))

    My text data looks like this:
    "3922TheftbyDeception"

    When I use this formula, I require the code '3922', but for some reason the second 2 is being eliminated, and i get an output '392'
    this is happening for all such cells where one number is repeated in the string.
    for eg., "2702AggravatedAssault" returns '270' instead of the desired '2702',
    "2902UnlawfulRestraint" returns '290' instead of the desired '2902', and so on.
    Please help, I'm at my wits end.
    thank you
    Tim

  40. I have a string of numbers 20180818
    I need to extract month and year in MMMM/YYYY format

  41. Hello. What if I have a specific number, for example 1231, but that number is obtained by a sum of 3 numbers? Can I extract numbers from that sum formula?

  42. FYI, this is way more complicated than necessary. In a column to the right of the list, I pulled out one of the numbersets manually and Excel auto-filled the rest. My numbers were surrounded by text on both sides and of varying length.

  43. Christopher:
    There are two instances of "07" in this sample string.
    If you want the first instance and the next 9 digits then where the string is in C13 enter this in and empty cell: =LEFT(C13,11)
    If you want the second instance and the next 9 digits then enter this in an empty cell: =RIGHT(C13,11)

  44. Hi guys,

    I have a number string for example like "07427640900247247520603080251507427640900" and I want to extract a 11 digit number starting with 07 from within this number string. How can you do it?

  45. Hi
    I have data like:
    sodium fluoride 1.1 mg O 0.5 mg fluoride
    benzydamine
    magnesium hydroxide 3 g O
    how can extract sodium fluoride, benzydamine,magnesium hydroxide to column b
    and 1.1, 3 to column b and mg, g to column c and o in column d
    Regards
    Majid

  46. Dear,
    a1 a2
    I have BXC123644 i want rezultate BXC1 all text and one number
    AEB56984fg5 AEB5
    CT12564984 CT1
    CDTMS56DGT CDTMS5

  47. Hi Guys - i want to extract the 2018 from the below text string in cell A3, can someone help? TES1-TEST-Bathtimes-2018, bloggs, joe

  48. Dear,

    do appreciate your guidance how to extract number with decimal from excel?

    for example |1234.56 USD| to |1234.56|

    Regards,
    Ronald

  49. we have a data like this:-
    r0fsd9958405019e34 Required Data : 9958405019
    5353w9810105370qw4354 : 9810105370
    ewrew8860339000dfdf : 8860339000
    erfsd9873903709sds4
    ewrew9810241172-35
    edsd9582121827dfd35
    rdf9999377066dfs5fd
    wer9873744954df43
    53sdf9818803734adf443

    I want to extract only mobile number which is 10 digit at each place, please let me know the easiest formula to extract these mobile number in simple way.
    Regards
    Sachin

    1. Hello, Sachin,

      If we understand your task correctly, you may find our Extract Text add-in helpful. Please try to use the "Extract by position" option to extract the 10-digit mobile numbers from your cells. Just enter "6" as the position number of the first character, set "10" as the number of characters to extract and click "Insert Results".

      1. Mary, can you share the exact formula as the example of Sachin question. I also want to know how to split the number from text following Sachin's query. Thanks in advance!

  50. Can also use the simple formula as below

    =MID(A2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789")),LEN(A2))

    Then hit Ctrl+Shift+Enter

    1. Another way to work around it.

      =RIGHT(A2,LEN(SUBSTITUTE(A2,{"0","1","2","3","4","5","6","7","8","9"},""))+1)

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 :)