Loncat ke daftar isi utama

Bagaimana menemukan posisi angka pertama / terakhir dalam string teks di Excel?

Misalnya, Anda memiliki daftar string teks yang merupakan campuran huruf dan angka. Jika Anda ingin mencari posisi angka pertama atau terakhir di setiap string, apa yang akan Anda lakukan? Sebenarnya, menggunakan rumus akan membantu Anda dengan cepat menemukan posisi angka pertama / terakhir dalam string teks tertentu. Dalam tutorial ini, kami akan menunjukkan kepada Anda detail penanganan masalah ini.

Temukan posisi angka pertama dalam string teks di Excel
Temukan posisi angka terakhir dalam string teks di Excel


Temukan posisi angka pertama dalam string teks di Excel

Seperti gambar di bawah ini yang ditampilkan, untuk menemukan posisi angka pertama dalam string teks, lakukan hal berikut.

1. Pilih sel B2, salin dan tempel salah satu rumus di bawah ini ke Formula Bar:

1). Formula 1: = MIN (SEARCH ({0,1,2,3,4,5,6,7,8,9}, A2 & "0123456789"));

2). Formula 2: =MATCH(TRUE,ABS(CODE(MID(A2,ROW($A$1:INDEX(A:A,LEN(A2))),1))-52.5)<5,0) + Ctrl + perubahan + Enter;

3). Formula 3: =MIN(IF(ISERROR(FIND({1;2;3;4;5;6;7;8;9;0},A2)),"",FIND({1;2;3;4;5;6;7;8;9;0},A2))).

2. Kemudian posisi angka pertama dari string pertama ditampilkan di sel B2. Sekarang seret Fill Handle ke sel B7 untuk mengisi kisaran di bawah ini.

Kemudian semua posisi angka pertama dari seluruh string dicantumkan.


Temukan posisi angka terakhir dalam string teks di Excel

Setelah menemukan posisi angka pertama, sekarang kita mulai mencari posisi angka terakhir dalam string.

Di bagian ini, ada dua rumus untuk Anda.

Formula 1: = MAX (IF (ISNUMBER (VALUE (MID (A2, ROW (INDIRECT ("1:" & LEN (A2))), 1))), ROW (TIDAK LANGSUNG ("1:" & LEN (A2)))) ) + Ctrl + perubahan + Enter;

Formula 2: =MAX(IFERROR(FIND({1,2,3,4,5,6,7,8,9,0},A2,ROW(INDIRECT("1:"&LEN(A2)))),0)) + Ctrl + perubahan + Enter

1. Pilih sel B2, salin dan tempel salah satu rumus di atas ke Formula Bar, lalu tekan Ctrl + Shift + Enter secara bersamaan. Kemudian Anda dapat melihat hasilnya ditampilkan di B2.

2. Pilih B2, seret Fill Handle ke bawah ke sel B7 untuk mengisi kisaran secara otomatis.

Kemudian Anda akan mendapatkan posisi dari semua angka terakhir dari seluruh string teks dengan segera.


Pisahkan teks dan angka dengan mudah dari satu sel menjadi dua kolom di Excel:

Dengan Kutools untuk Excel'S Pisahkan Sel utilitas, Anda dapat membagi rentang sel menjadi baris atau kolom dengan pemisah tertentu, memisahkan teks dan angka, atau memisahkan teks dengan panjang tertentu. Unduh dan coba sekarang! (Jejak gratis 30 hari)


Artikel terkait:

Alat Produktivitas Kantor Terbaik

🤖 Kutools AI Ajudan: Merevolusi analisis data berdasarkan: Eksekusi Cerdas   |  Hasilkan Kode  |  Buat Rumus Khusus  |  Analisis Data dan Hasilkan Grafik  |  Aktifkan Fungsi Kutools...
Fitur Populer: Temukan, Sorot, atau Identifikasi Duplikat   |  Hapus Baris Kosong   |  Gabungkan Kolom atau Sel tanpa Kehilangan Data   |   Putaran tanpa Formula ...
Pencarian Super: VLookup Beberapa Kriteria    VLookup Nilai Berganda  |   VLookup di Beberapa Lembar   |   Pencarian Fuzzy ....
Daftar Drop-down Lanjutan: Buat Daftar Drop Down dengan Cepat   |  Daftar Drop Down yang Bergantung   |  Multi-pilih Drop Down List ....
Manajer Kolom: Tambahkan Jumlah Kolom Tertentu  |  Pindahkan Kolom  |  Alihkan Status Visibilitas Kolom Tersembunyi  |  Bandingkan Rentang & Kolom ...
Fitur Unggulan: Fokus Kisi   |  Tampilan Desain   |   Bar Formula Besar    Manajer Buku Kerja & Lembar   |  Perpustakaan Sumberdaya (Teks otomatis)   |  Pemetik tanggal   |  Gabungkan Lembar Kerja   |  Enkripsi/Dekripsi Sel    Kirim Email berdasarkan Daftar   |  Filter Super   |   Filter Khusus (filter tebal/miring/coret...) ...
15 Perangkat Teratas12 Teks Tools (Tambahkan Teks, Hapus Karakter, ...)   |   50 + Grafik jenis (Gantt Chart, ...)   |   40+ Praktis Rumus (Hitung usia berdasarkan ulang tahun, ...)   |   19 Insersi Tools (Masukkan Kode QR, Sisipkan Gambar dari Jalur, ...)   |   12 Konversi Tools (Angka ke Kata, Konversi Mata Uang, ...)   |   7 Gabungkan & Pisahkan Tools (Lanjutan Gabungkan Baris, Pisahkan Sel, ...)   |   ... dan banyak lagi

Tingkatkan Keterampilan Excel Anda dengan Kutools for Excel, dan Rasakan Efisiensi yang Belum Pernah Ada Sebelumnya. Kutools for Excel Menawarkan Lebih dari 300 Fitur Lanjutan untuk Meningkatkan Produktivitas dan Menghemat Waktu.  Klik Di Sini untuk Mendapatkan Fitur yang Paling Anda Butuhkan...

Deskripsi Produk


Tab Office Membawa antarmuka Tab ke Office, dan Membuat Pekerjaan Anda Jauh Lebih Mudah

  • Aktifkan pengeditan dan pembacaan tab di Word, Excel, PowerPoint, Publisher, Access, Visio, dan Project.
  • Buka dan buat banyak dokumen di tab baru di jendela yang sama, bukan di jendela baru.
  • Meningkatkan produktivitas Anda sebesar 50%, dan mengurangi ratusan klik mouse untuk Anda setiap hari!
Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Ich habe gerade diese Lösung ausprobiert und es klappt bei mir nicht. Hat sich inzwischen etwas, was die Matrixformel betrifft, geändert?
This comment was minimized by the moderator on the site
Hi Wolfgang,

The formulas provided in this post work well in my case. What result did you get?
This comment was minimized by the moderator on the site
Thought I would let everyone know that I needed to find the last position of the house numbers in an address field in access. The only way I could do this was to export a short query to excel and run this formula. I know there is a way to get the excel functions in access but this was much easier. I had addresses that had varying house number lengths and then you throw in the 1st, 2nd, 3rd...St., Ave into the mix within the street name and you got a major problem parsing a very bad formatted address string.

address examples 1234 nw (or NW) 4th St.
12 West St North (or N)
123,456, and 789 Heritage Circle (or Crc)
123 & 456 N 1st. St

I figured out a way to parse off the first and second example real quick with some research (I would give credit, but right now I can't remember where I got the answer). It involved creating a VBA function to accomplish it. That worked great but I came to a problem when we come to the first "," or "and" or "&".

Using this formula in excel found the last number I needed without choosing the street number. Since most house numbers ended with a space " " between them and the direction segment or the street name segment, I added --- &" " after the find formula. Like this: in an array formula
=MAX(IFERROR(FIND({1,2,3,4,5,6,7,8,9,0}&" ",E2,ROW(INDIRECT("1:"&LEN(E2)))),0))
A quick export back to an access table and wala! you have the number.
202 & 206 N Blanche Ave = 9

Now I know I could probably parse the rest of the address in excel but it actually worked real well in Access, so I just decided to do the rest there.

If there is a way to do it all in Access, I couldn't find it or figure it out.
This comment was minimized by the moderator on the site
goood, thanks
This comment was minimized by the moderator on the site
That's what I needed =MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"));

thank you very much!
This comment was minimized by the moderator on the site
You are welcome O(∩_∩)O
This comment was minimized by the moderator on the site
how to get this to work in powerpivot
This comment was minimized by the moderator on the site
Hi,
Sorry can't help with this.
This comment was minimized by the moderator on the site
.... and here I thought that I knew Excel well. Bravo!!!!!
This comment was minimized by the moderator on the site
And here is a formula for finding the position of the last numeric character in a string, but WITHOUT using an array formula: =MAX(SEARCH(CHAR(9),SUBSTITUTE("0123456789"&A1,{0,1,2,3,4,5,6,7,8,9},CHAR(9),LEN(A1)+10-LEN(SUBSTITUTE("0123456789"&A1,{0,1,2,3,4,5,6,7,8,9},"")))))-10 The number 10 appearing in this formula, are due to the length of the constant string "0123456789", that is concatenated in this formula.
This comment was minimized by the moderator on the site
Many Thanks , Great
This comment was minimized by the moderator on the site
Hi George, your formula is may meet my requirement. I need similar formula to find out digit position in the string listed in "A" row in B row Required output 8 5 1 4 3 1 3 2 5 5 6 6 1 7 9 9 1 1 6 0 9 3 0 2 7 4 9 3 6 5 5 7 4 9 8 10 2 10 0 8 1 9
This comment was minimized by the moderator on the site
This was exactly what I wanted. Thank you.
This comment was minimized by the moderator on the site
The function 1). Formula 1: =MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789")); It's absolutely what i needed and extremely cool! Thanks so much! Jon
This comment was minimized by the moderator on the site
Hats off mate..
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations