跳到主要內容

如何從Excel中的字符串中提取前/後n個字符?

例如,在每個單元格中都有一個包含長字符串的列表,您只想從每個字符串中提取前n個字符,就像每個字符串的前3個字符一樣,現在您可以使用以下方法在Excel中解決它。

使用公式從字符串中提取前/後n個字符

使用Kutools for Excel從字符串中提取前/後n個字符

快速從Excel單元格中刪除特殊字符(數字/字母)

只需點擊幾下 刪除字符 的效用 Excel的Kutools,特殊字符將立即從單元格中刪除。
點擊取得30天免費試用!
doc移除字元
Kutools for Excel:擁有300多個便捷的Excel加載項,可以在30天內免費試用。

箭頭藍色右氣泡 使用公式從字符串中提取前/後n個字符

從字符串中提取前n個字符

選擇一個空白單元格,在這裡我選擇單元格G1,然後鍵入此公式 =左(E1,3) (E1是要從中提取前三個字符的單元格),按 Enter 按鈕,然後將填充手柄拖到所需的範圍。 然後您會看到提取了前3個字符。

如果要提取後n個字符(例如後3個字符),請輸入以下公式 =右(E1,3).


箭頭藍色右氣泡 使用Kutools for Excel從字符串中提取前/後n個字符

按位置刪除 的特點 Excel的Kutools 還可以僅從Excel中的字符串中提取前n個或後n個字符。

Excel的Kutools 包括300多個便捷的Excel工具。 30天免費試用,不受限制。 立即獲取

1.首先選擇要提取的前3個字符的範圍,然後單擊 庫工具 > 文本工具 > 按位置刪除。 看截圖:

2。 在裡面 按位置刪除 對話框中,您需要在字符串中輸入要從字符串中刪除的字符數。 民數記 文本框,例如在這種情況下,我想保留前3個字符,因此我需要從右側刪除8個字符,然後檢查 從右邊。 看截圖

3。 點擊 Ok,您只會看到前三個字符被保留。

尖端:如果要提取最後3個字符,請選中從左開始,然後指定要從字符串中刪除的字符數。

注意:

1.應用此功能將更改您的原始數據,最好先複製它們。

2.只有每個單元格中的所有字符串都有一些字符,此功能才能正常工作。

單擊此處以獲取有關按位置刪除的更多信息。


相關文章:

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
A1

UAN 101371765394, want only this Specific number 101371765394

Then =MID(A1,4,LEN(A1))
This comment was minimized by the moderator on the site
Line No: 2 AADHAAR XXXX XXXX 7842 is already mapped with UAN 101371765394,101371765394


This is paragraph i want only this number 101371765394.How i can get only number what is the formula for this. Kindly help us
This comment was minimized by the moderator on the site
So I want to build a formula to make a unique id number with a persons first three letters of last name and first 2 letters of first name and zeros to fill in the rest in total 8 characters? Did I ask correctly?
This comment was minimized by the moderator on the site
Hi, Cynthia Ferrera, no one formula can finish that job, but you can use multiple formulas to handle it, if you are interested in the solution, you can view the screen. If you do not want to use such many formulas, you can try Kutools for Excel' Split Names function and Extract Text function to finish the task.
This comment was minimized by the moderator on the site
i'm trying to set up a formula in my current worksheet. i want to remove everything after the first 5 numbers. I cant use kutools app at work. I dont know how to add the formula in to my current one. Any thoughts? the 53090 is what i would want and that is located in cell Q. This is a break down of 75 different numbers for different groups. I have each set of numbers assigned to a different grouping. As of right now i manually have to keep removing the extra numbers from each cell.

=SUM(COUNTIFS($O$12:$O$193,"530",$Q$12:$Q$193,{"53090","53095"}))
This comment was minimized by the moderator on the site
just use left

=left() click on the text you want to use, then the number of characters 5
This comment was minimized by the moderator on the site
hi, The Left/Right function works but it prints number as text. I mean when I try to apply the formula to extracted digits it do not give any output. I hope u understand what I am Trying to say
This comment was minimized by the moderator on the site
I love Kutools explanation needs to say this Kutools works only if the cells have the same number of characters. It won't work if the cells have different number of characters. For example, say I want to extract the first character of these FDIC board members ie, M, L and B. Kutools won't do it. But "=LEFT(E1,3)" in the first technique will work.
Martin J. Gruenberg
Lorraine Dennison
Barbara Ryan
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations