Preskoči na glavno vsebino

Kako v Excelu izvleči številko samo iz besedilnega niza?


1. način: Izvlecite številko samo iz besedilnih nizov s formulo

Naslednja dolga formula vam lahko pomaga, da iz besedilnih nizov izvlečete samo številke, naredite tako:

Izberite prazno celico, v katero želite izvleči številko, nato vnesite to formulo: = SUMPRODUCT (MID (0 & A5, LARGE (INDEX (ISUMBER (- MID (A5, ROW (INDIRECT ("1:" & LEN (A5)), 1)) * ROW (INDIRECT ("1:" & LEN (A5) )), 0), ROW (INDIRECT ("1:" & LEN (A5)))) + 1, 1) * 10 ^ ROW (INDIRECT ("1:" & LEN (A5))) / 10)in nato povlecite ročico za polnjenje, da zapolnite obseg, ki ga potrebujete za uporabo te formule. Oglejte si posnetek zaslona:

doc izvleči samo številke 2

Opombe:

  • 1. A5 stoji prvi podatek, ki ga želite črpati samo s seznama.
  • 2. Rezultat bo prikazan kot 0, če v nizu ni številk.

Izvleči številke samo iz besedilnih nizov:

z Kutools za ExcelJe ŠTEVILO ŠTEVILK funkcijo, lahko iz celic besedilnega niza hitro izvlečete samo številke. Kliknite za prenos Kutools za Excel!

doc izvleči samo številke 14


2. način: Izvlecite številko samo iz besedilnih nizov s kodo VBA

Tu je koda VBA, ki vam lahko tudi naredi uslugo, storite naslednje:

1. Držite tipko Alt + F11 tipke za odpiranje Microsoft Visual Basic za aplikacije okno.

2. Kliknite Vstavi > Moduliin prilepite naslednjo kodo v Moduli Okno.

Koda VBA: Izvleči številko samo iz besedilnega niza:

Sub ExtrNumbersFromRange()
    Dim xRg As Range
    Dim xDRg As Range
    Dim xRRg As Range
    Dim nCellLength As Integer
    Dim xNumber As Integer
    Dim strNumber As String
    Dim xTitleId As String
    Dim xI As Integer
    xTitleId = "KutoolsforExcel"
    Set xDRg = Application.InputBox("Please select text strings:", xTitleId, "", Type:=8)
    If TypeName(xDRg) = "Nothing" Then Exit Sub
    Set xRRg = Application.InputBox("Please select output cell:", xTitleId, "", Type:=8)
    If TypeName(xRRg) = "Nothing" Then Exit Sub
    xI = 0
    strNumber = ""
  For Each xRg In xDRg
    xI = xI + 1
    nCellLength = Len(xRg)
    For xNumber = 1 To nCellLength
      If IsNumeric(Mid(xRg, xNumber, 1)) Then
        strNumber = strNumber & Mid(xRg, xNumber, 1)
      End If
    Next xNumber
    xRRg.Item(xI) = strNumber
    strNumber = ""
  Next xRg
End Sub

3. In nato pritisnite F5 tipko za zagon te kode in pojavilo se bo pozivno polje, ki bo opozorilo na izbiro obsega besedila, ki ga želite uporabiti, glejte posnetek zaslona:

doc izvleči samo številke 3

4. Nato kliknite OK, sledi še eno pozivno polje, izberite celico za prikaz rezultata, glejte posnetek zaslona:

doc izvleči samo številke 4

5. Končno kliknite OK in vse številke v izbranih celicah so bile izvlečene hkrati.


3. način: s Kutools za Excel izvlecite številko samo iz besedilnega niza

Kutools za Excel ima tudi močno funkcijo, ki se imenuje ŠTEVILO ŠTEVILK, s to funkcijo lahko hitro izvlečete samo številke iz prvotnih besedilnih nizov.

Kutools za Excel : z več kot 300 priročnimi dodatki za Excel, ki jih lahko brezplačno preizkusite v 30 dneh

Po namestitvi Kutools za Excel, naredite naslednje:

1. Kliknite celico poleg besedilnega niza, kamor boste postavili rezultat, glejte posnetek zaslona:

doc izvleči samo številke 5

2. Nato kliknite Kutools > Kutools funkcije > Besedilo > ŠTEVILO ŠTEVILK, glej posnetek zaslona:

doc izvleči samo številke 6

3. v Argumenti funkcije v pogovornem oknu izberite celico, v katero želite izvleči številke iz Txt in vnesite Res or false v N besedilno polje, glej posnetek zaslona:

doc izvleči samo številke 7

Opombe: argument N je neobvezen element, če vnesete Res, če vnesete, bo vrnil številke kot številčne false, vrnil bo številke v obliki besedila, privzeta vrednost je false, zato jo lahko pustite prazno.

4. In nato kliknite OK, številke so bile izvlečene iz izbrane celice, nato povlecite ročico za polnjenje navzdol do celic, za katere želite uporabiti to funkcijo, dobili boste naslednji rezultat:

doc izvleči samo številke 8

Kliknite za prenos in brezplačno preskusno različico Kutools za Excel zdaj!


4. način: Iz besedilnega niza s formulo izvlecite samo decimalno število

Če besedilni nizi, ki vključujejo nekaj decimalnih števil na vašem delovnem listu, kako lahko iz besedilnih nizov izvlečete samo decimalna števila?

Spodnja formula vam lahko pomaga hitro in enostavno izvleči decimalna števila iz besedilnih nizov.

Vnesite to formulo:=LOOKUP(9.9E+307,--LEFT(MID(A5,MIN(FIND({1,2,3,4,5,6,7,8,9,0}, $A5&"1023456789")),999),ROW(INDIRECT("1:999")))), In nato izpolnite ročico do celic, ki jih želite vsebovati s to formulo, vsa decimalna števila so bila izvlečena iz besedilnih nizov, glejte posnetek zaslona:

doc izvleči samo številke 13


Izvlecite številko samo iz nizov s programom Kutools za Excel

Kutools za Excel: z več kot 300 priročnimi dodatki za Excel, brezplačno preizkusite brez omejitev v 30 dneh. Prenesite in brezplačno preskusite zdaj!

Relativni članki:

Najboljša pisarniška orodja za produktivnost

🤖 Kutools AI Aide: Revolucionirajte analizo podatkov na podlagi: Inteligentna izvedba   |  Ustvari kodo  |  Ustvarite formule po meri  |  Analizirajte podatke in ustvarite grafikone  |  Prikličite funkcije Kutools...
Priljubljene funkcije: Poiščite, označite ali identificirajte dvojnike   |  Izbriši prazne vrstice   |  Združite stolpce ali celice brez izgube podatkov   |   Krog brez formule ...
Super iskanje: Več kriterijev VLookup    Multiple Value VLookup  |   VLookup na več listih   |   Nejasno iskanje ....
Napredni spustni seznam: Hitro ustvarite spustni seznam   |  Odvisni spustni seznam   |  Večkrat izberite spustni seznam ....
Upravitelj stolpcev: Dodajte določeno število stolpcev  |  Premakni stolpce  |  Preklop stanja vidnosti skritih stolpcev  |  Primerjaj obsege in stolpce ...
Predstavljene funkcije: Mrežni fokus   |  Pogled oblikovanja   |   Velika vrstica formule    Upravitelj delovnih zvezkov in listov   |  Knjižnica virov (Samodejno besedilo)   |  Izbirnik datuma   |  Združite delovne liste   |  Šifriranje/dešifriranje celic    Pošljite e-pošto po seznamu   |  Super filter   |   Poseben filter (filter krepko/ležeče/prečrtano ...) ...
15 najboljših kompletov orodij12 Besedilo Orodja (dodajanje besedila, Odstrani znake,...)   |   50 + Graf Vrste (Gantt Chart,...)   |   40+ Praktično Formule (Izračunajte starost glede na rojstni dan,...)   |   19 vstavljanje Orodja (Vstavite kodo QR, Vstavi sliko s poti,...)   |   12 Pretvorba Orodja (Številke v besede, Pretvorba valut,...)   |   7 Spoji in razdeli Orodja (Napredne kombinirane vrstice, Razdeljene celice,...)   |   ... in več

Napolnite svoje Excelove spretnosti s Kutools za Excel in izkusite učinkovitost kot še nikoli prej. Kutools za Excel ponuja več kot 300 naprednih funkcij za povečanje produktivnosti in prihranek časa.  Kliknite tukaj, če želite pridobiti funkcijo, ki jo najbolj potrebujete...

Opis


Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50%in vsak dan zmanjša na stotine klikov miške za vas!
Comments (61)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
how to get a extract extact numbers from text
This comment was minimized by the moderator on the site
Hi, I'm looking to list all numbers in a string before a certain character. The string has letters and numbers, so I want to remove the letters and only list the numbers that appear before the second minus sign "-". Example:MUMUT-S941-22460991e002
I want that to isolate the numbers 941 in the above example.
This comment was minimized by the moderator on the site
How to use Index instead of Indirect to extract number from string. Indirect is volatile and Index can replace it as per http://www.excelhero.com/blog/2011/03/the-imposing-index.html. Thanks Ahead!
This comment was minimized by the moderator on the site
Hello! I found the following formula to extract only the numbers from text strings in Excel very useful

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

Could you explain more on this formula as it seems quite complicated? Many thanks.
This comment was minimized by the moderator on the site
Reading ID: 3151346 BeatO User ID: 239930 Name: Mahesh Phone: 9823010759 Email: City: nashik State: Maharashtra Reading: 55 Meal Time: Random Meal Type: RANDOM Reading Time: 2020-03-01 00:15:57 View user readings in Portal



I want to extract numeric no. post Reading text
This comment was minimized by the moderator on the site
Hello, how can i extract the cheque no.only from the below text

OUTWARD CLEARING CLRG CHQ DEPOSIT CHQ. NO: 000123~700320456 ABCD ARAB PLAZ BRANC Value DATE, 01/02/2020 - S79519642

i tried below formula and its working but i need to change the 1:57 by calculating how many character before the first digit plus how many digits i want to extract.
=MIN(FIND({0,1,2,3,4,5,6,7,8,9},A3&"0123456789"))+5 im using this formula to know how many characters before the first number..

=TEXTJOIN("",TRUE,IFERROR(MID(A3,ROW(INDIRECT("1:57")),1)+0,""))
This comment was minimized by the moderator on the site
=Mid(A2,find("CHQ. NO", A2)+9,6)
This comment was minimized by the moderator on the site
Hi. I wonder to know is it possible to extract from the next string '102-105+106-10605-10605 -10631-10632-10633-10634-10635+107' all values of only three digits that have sign '-' (i.e. minus) before them (or plus - doesn't matter). Then extract extract all 5-digits values with the same rule? If this is possible to do I will save many many hours of manual work that I can devote to lot's of uselful tasks.

P.S.
I know that regular expressions are able to do that, BUT... I hate their syntax, so I'm searching any other method to complete this task.

Thanks in advance.
This comment was minimized by the moderator on the site
Hi, is it possible to extract the numbers before "g", for example : 25,20,15,25,300,40

Ali Baba Dark Chocolate 25g box 12 pcs
Ali Baba Dark Chocolate 20g*24 box
Cadbury 5 Star White Chocolate 15g
Kinder 2 White Chocolate 25g*24
ALpella Biscuits W/Marshmallow300g
Alpella Chocolate 40g
This comment was minimized by the moderator on the site
did anyone answer or did you figure this out? this is exactly my problem right - even down to the letter 'g'. the problem with the formula I am using now is that it returns the first number, if there are more than one, from the string and not the number I am wishing to return.
This comment was minimized by the moderator on the site
Hi, is it possible to extract the numbers before "g", for example : 25,20,15,25,300,40


Ali Baba Dark Chocolate 25g box 12 pcs
Ali Baba Dark Chocolate 20g*24 box
Cadbury 5 Star White Chocolate 15g
Kinder 2 White Chocolate 25g*24
ALpella Biscuits W/Marshmallow300g
Alpella Chocolate 40g
This comment was minimized by the moderator on the site
can any one answer this question, how to extract the no's
This comment was minimized by the moderator on the site
You may try select the number before g in the first cell, copy and paste it in new cell. Then press CTRL + E. All the number before g will be auto generated. 

This comment was minimized by the moderator on the site
Tkssssss you saved my day :) God bless you
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations