跳到主要內容
普通 ChatGPT 用戶? 嘗試整合 ChatGPT ExtendOffice.

如何在Excel中反轉文本字符串或單詞順序?

作者:小陽 最後修改時間:2020-06-04

使用Excel工作表時,如何在Excel中反轉文本字符串或單詞順序? 例如,您想將“Excel是對我們有用的工具“要”su lof lufesu a si lexxE”。 有時您可能會顛倒順序,例如“Excel,Word,PowerPoint,OneNote“要”OneNote,PowerPoint,Word,Excel”。 通常這很難解決這個問題。 請查看以下方法:

使用用戶定義的功能反轉文本字符串

反向單詞順序由特定分隔符使用VBA代碼分隔

使用Kutools for Excel快速輕鬆地反轉文本字符串或單詞順序


箭頭藍色右氣泡 使用用戶定義的功能反轉文本字符串

假設您有一系列要反轉的文本字符串,例如“在Excel中添加前導零“要”lecxE ni sorez gnidael dda”。 您可以按照以下步驟撤消文本:

1。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下宏粘貼到 模塊窗口。

Function Reversestr(str As String) As String
    Reversestr = StrReverse(Trim(str))
End Function

3。 然後保存並關閉此代碼,返回工作表,並輸入以下公式: = reversestr(A2) 放入空白單元格以放入結果,請參見屏幕截圖:

4。 然後向下拖動填充手柄以復制此公式,單元格中的文本立即得到確認,請參見屏幕截圖:


箭頭藍色右氣泡 反向單詞順序由特定分隔符使用VBA代碼分隔

如果您有一個用逗號分隔的單元格列表,例如“老師,醫生,學生,工人,司機”,而您想要顛倒這樣的單詞“ order”駕駛,工人,學生,醫生,老師”。 您也可以使用Follow VBA來解決它。

1。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications 窗口。

2。 點擊 插入 > 模塊,然後將以下宏粘貼到 模塊 窗口。

Sub ReverseWord()
'Updateby Extendoffice
Dim Rng As Range
Dim WorkRng As Range
Dim Sigh As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Sigh = Application.InputBox("Symbol interval", xTitleId, ",", Type:=2)
For Each Rng In WorkRng
    strList = VBA.Split(Rng.Value, Sigh)
    xOut = ""
    For i = UBound(strList) To 0 Step -1
        xOut = xOut & strList(i) & Sigh
    Next
    Rng.Value = xOut
Next
End Sub

3。 然後按 F5 鍵,將顯示一個對話框,請選擇要使用的範圍。 看截圖:

4。 然後按 Ok,會彈出另一個對話框,供您指定要基於其反轉單詞的分隔符,請參見屏幕截圖:

5. 然後點擊 OK,您會看到所選單詞被顛倒了,請參見屏幕截圖:


箭頭藍色右氣泡 使用Kutools for Excel快速輕鬆地反轉文本字符串或單詞順序

Excel的Kutools反向文字順序 可以幫助您快速方便地反轉各種文本字符串。 它可以執行以下操作:

從右向左反轉文本,例如“點擊一些單詞“要”斯德羅·埃莫斯·帕特“;

反向文本由空格或其他特定字符分隔,例如“蘋果橙葡萄“要”葡萄橙蘋果“;

Excel的Kutools : 帶有300多個便捷的Excel加載項,可以在30天內免費試用

從右到左反轉文本:

1。 選擇要撤消的範圍。

2。 點擊 庫工具 > 文本工具 > 反向文字順序,請參見屏幕截圖:

3。 在 反向文本 對話框,從中選擇適當的選項 分離器 與單元格值相對應。 您可以預覽 預覽窗格。 看截圖:

 立即下載和免費試用Excel的Kutools!


反向文本由空格或其他特定字符分隔:

此功能還可以幫助您反轉由特定字符分隔的文本字符串。

1. 選擇單元格,然後單擊以應用此實用程序 庫工具 > 文本 > 反向文字順序.

2.反向文本 對話框中,選擇分隔符,該分隔符用於分隔要基於其反轉單詞的單元格值,請參見屏幕截圖:

3。 然後點擊 Ok or 申請成為成員,單元格中的單詞立即被反轉了。 查看屏幕截圖:

備註:檢查 跳過非文字 單元格,以防止您反轉所選範圍內的數字。

要了解有關此功能的更多信息,請訪問 反向文字順序.

立即下載和免費試用Excel的Kutools!


箭頭藍色右氣泡 演示:使用Kutools for Excel基於特定分隔符的反向文本字符串

Excel的Kutools:具有300多個方便的Excel加載項,可以在30天內免費試用,沒有任何限制。 立即下載並免費試用!

相關文章:

如何在Excel中的單元格中翻轉名字和姓氏?

最佳辦公生產力工具

🤖 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 (20)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
=UNIRTEXTO("";1;EXT.TEXTO(A2;{20\19\18\17\16\15\14\13\12\11\10\9\8\7\6\5\4\3\2\1};1))
This comment was minimized by the moderator on the site
Ik zoek een manier om een heleboel woorden in 'rijm-fabetische volgorde' te zetten. Dus de laatste letters van het woord moeten in alfabetische volgorde. Iemand enig idee? VrGr Amanda
This comment was minimized by the moderator on the site
This is truly a great help ... Thank you so much
This comment was minimized by the moderator on the site
awesome very helpful thanks for sharing the details
This comment was minimized by the moderator on the site
Thank you very much. This code helped my friend in a very good way
This comment was minimized by the moderator on the site
Is it possible to start the reverse at a certain character length (for the user-defined function or VBA code)? For example, reverse cell A1 values starting after the character count equal to B1 value. So if B1 is 10 characters reverse will start at characters 11+ in A1..
This comment was minimized by the moderator on the site
I found that the original Sub gave out the results with additional sigh at the end of all selected cells. So I fixed this part. For i = UBound(strList) To 0 Step -1 If i > 0 Then xOut = xOut & strList(i) & Sigh Else xOut = xOut & strList(i) Next Rng.Value = xOut
This comment was minimized by the moderator on the site
It's possible to reverse text using formula, it is repetitive and limited to how far you are prepared to go and subject to number of characters excel will allow in the formula bar. Max length of text will be 30 chars and is in cell A1. Cell B1 would read: =TRIM(MID(LEFT(A1&REPT(" ",31),31),30,1)&MID(LEFT(A1&REPT(" ",31),31),29,1)&MID(LEFT(A1&REPT(" ",31),31),28,1)&MID(LEFT(A1&REPT(" ",31),31),27,1)&MID(LEFT(A1&REPT(" ",31),31),26,1)&MID(LEFT(A1&REPT(" ",31),31),25,1)&MID(LEFT(A1&REPT(" ",31),31),24,1)&MID(LEFT(A1&REPT(" ",31),31),23,1)&MID(LEFT(A1&REPT(" ",31),31),22,1)&MID(LEFT(A1&REPT(" ",31),31),21,1)&MID(LEFT(A1&REPT(" ",31),31),20,1)&MID(LEFT(A1&REPT(" ",31),31),19,1)&MID(LEFT(A1&REPT(" ",31),31),18,1)&MID(LEFT(A1&REPT(" ",31),31),17,1)&MID(LEFT(A1&REPT(" ",31),31),16,1)&MID(LEFT(A1&REPT(" ",31),31),15,1)&MID(LEFT(A1&REPT(" ",31),31),14,1)&MID(LEFT(A1&REPT(" ",31),31),13,1)&MID(LEFT(A1&REPT(" ",31),31),12,1)&MID(LEFT(A1&REPT(" ",31),31),11,1)&MID(LEFT(A1&REPT(" ",31),31),10,1)&MID(LEFT(A1&REPT(" ",31),31),9,1)&MID(LEFT(A1&REPT(" ",31),31),8,1)&MID(LEFT(A1&REPT(" ",31),31),7,1)&MID(LEFT(A1&REPT(" ",31),31),6,1)&MID(LEFT(A1&REPT(" ",31),31),5,1)&MID(LEFT(A1&REPT(" ",31),31),4,1)&MID(LEFT(A1&REPT(" ",31),31),3,1)&MID(LEFT(A1&REPT(" ",31),31),2,1)&MID(LEFT(A1&REPT(" ",31),31),1,1)) Result: A1: Duncan Sullivan-Shaw B1: wahS-navilluS nacnuD Basically your text in cell A1 becomes 31 characters long by adding enough spaces to enable this, and each character is read singularly from right to left until you reach the first character. This will result in your reversed text containing leading spaces, which the TRIM command removes for you. To reduce or increase the length you would remove or add each statement. The number within the REPT statement should be 1 more than the maximum length you are working to and your first MID statement will start at the maximum length working down to 1.
This comment was minimized by the moderator on the site
hi all, i don't have Kutools to reverse a character of text, if anybody has this tools and want to help me, please send me email to send my file to you for reverse. my email is: [b][b][/b][/b] with regards,
This comment was minimized by the moderator on the site
please go through the instructions give by the extend office website after searching with google by reverse string in excel.
This comment was minimized by the moderator on the site
Hi I would like to reverse Dates. 20/11/2015 to 2015/11/20 Any Help? Thanks
This comment was minimized by the moderator on the site
For dates all you need to do is change the format of the cell to the format needed. Right click on the cell you would like to reverse and select format cell. Select Date under the category section and change the location from wherever you are to US or Czech or another country that may use the format you are interested in. Then pick the one that matches your requirements.
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