Note: The other languages of the website are Google-translated. Back to English
登入  \/ 
x
or
x
註冊  \/ 
x

or

如何在Excel中自動增加一個字母以獲得下一個字母?

假設您有一個包含字母AB的單元格,則需要將最後一個字母增加一個,以獲取下一個字母AC,AD等。 或者,您有一個字母A,並且想要將該字母增加到B,C…以創建一個字母列表。 如何實現呢? 本文可以為您提供詳細信息。

用公式將字母AB加XNUMX以得到AC,AD…
將字母加XNUMX可獲得帶有公式的字母列表
使用用戶定義的功能將字母增加XNUMX以獲取字母列表


用公式將字母AB加XNUMX以得到AC,AD…

請按照以下步驟在Excel中將字母增加XNUMX。

1.在給定字母下方選擇一個空白單元格,在其中輸入以下公式,然後按 Enter 鍵。 

=IF(RIGHT($A2,1)="Z", CHAR(CODE(LEFT(A2,1))+1),LEFT(A2,1))&CHAR(65+MOD(CODE(RIGHT(A2,1))+1-65,26))

備註:在公式中,A2是包含給定字母的單元格。

2.繼續選擇A3,向下拖動“填充手柄”以獲取所需字母的列表。


將字母A加XNUMX以得到帶有公式的字母列表

您可以使用 =字符(CODE(A1)+1) 在Excel中將字母加XNUMX的公式。 請執行以下操作。

1.在給定字母下方選擇一個空白單元格,輸入公式 =字符(CODE(A2)+1) 進入編輯欄,然後按 Enter 鍵。 看截圖:

2.選擇結果單元格,向下拖動“填充手柄”以獲取所需的字母。

備註:使用此公式,得到字母Z後,如果繼續向下拖動Fill Handle,將得到一些特殊字符,如下圖所示。 如果要在Z後面獲得字母AA,可以使用以下用戶定義的函數來幫助您。


使用用戶定義的功能將字母增加XNUMX以獲取字母列表

以下用戶定義的函數還可以幫助您在Excel中增加一個字母。

1。 按 其他 + F11 同時打開 Microsoft Visual Basic for Applications 窗口。

2。 在裡面 Microsoft Visual Basic for Applications 窗口中,單擊 插入 > 模塊。 然後將以下VBA代碼複製並粘貼到 模塊 窗口。

VBA代碼:將字母增加一個以獲取字母列表

Function ColLtrs(i As Long) As String
    ColLtrs = Replace(Cells(1, i).Address(False, False), "1", "")
End Function

3。 按 其他 + Q 關閉鍵 Microsoft Visual Basic for Applications 窗口。

4.在給定字母下方選擇一個空白單元格,輸入公式 = ColLtrs(ROW()),然後按 Enter 獲得第二個字母的鑰匙。

2.選擇結果單元格,向下拖動“填充手柄”以獲取所需的字母。

備註:使用此方法,您增加的字母基於行號。 您需要在工作表的第一行中開始第一個字母A,否則,該字母將變得混亂。


最佳辦公效率工具

Kutools for Excel解決了您的大多數問題,並使您的生產率提高了80%

  • 重用: 快速插入 複雜的公式,圖表 以及您以前使用過的任何東西; 加密單元 帶密碼 創建郵件列表 並發送電子郵件...
  • 超級公式欄 (輕鬆編輯多行文本和公式); 閱讀版式 (輕鬆讀取和編輯大量單元格); 粘貼到過濾範圍...
  • 合併單元格/行/列 不會丟失數據; 拆分單元格內容; 合併重複的行/列...防止細胞重複; 比較範圍...
  • 選擇重複或唯一 行; 選擇空白行 (所有單元格都是空的); 超級查找和模糊查找 在許多工作簿中; 隨機選擇...
  • 確切的副本 多個單元格,無需更改公式參考; 自動創建參考 到多張紙; 插入項目符號,複選框等...
  • 提取文字,添加文本,按位置刪除, 刪除空間; 創建和打印分頁小計; 在單元格內容和註釋之間轉換...
  • 超級濾鏡 (將過濾方案保存並應用於其他工作表); 高級排序 按月/週/日,頻率及更多; 特殊過濾器 用粗體,斜體...
  • 結合工作簿和工作表; 根據關鍵列合併表; 將數據分割成多個工作表; 批量轉換xls,xlsx和PDF...
  • 超過300種強大功能。 支持Office / Excel 2007-2019和365。支持所有語言。 在您的企業或組織中輕鬆部署。 完整功能30天免費試用。 60天退款保證。
kte選項卡201905

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

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 每天將您的工作效率提高50%,並減少數百次鼠標單擊!
officetab底部
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    brickh7777@gmail.com · 1 years ago
    Screenshot?
    I think he explained it succinctly.
  • To post as a guest, your comment is unpublished.
    brickh7777@gmail.com · 1 years ago
    How do I get it to start over at A when Z is used?
  • To post as a guest, your comment is unpublished.
    Me · 1 years ago
    @Harold McBroom Everything man does is corrupt. Everything.
  • To post as a guest, your comment is unpublished.
    Me · 1 years ago
    Yeah Dan! DAH!
    You seem to assume we're all brainiacs like you Dan.
    You can't possibly expect us to wrap our heads around what you mean without screenshots! Wow!
  • To post as a guest, your comment is unpublished.
    Zac · 2 years ago
    This code will allow you to go from A to ZZ.

    =IF(B2="Z","AA",IF(LEN(B2)=1,CHAR(CODE(B2)+1),IF(RIGHT(B2,1)="Z",CHAR(CODE(LEFT(B2,1))+1),LEFT(B2,1))&CHAR(65+MOD(CODE(RIGHT(B2,1))+1-65,26))))
  • To post as a guest, your comment is unpublished.
    crystal · 2 years ago
    @afzalss Hi,
    Please select the number cells and run the below code to solve the problem.

    Sub NumTOAZ()
    Dim xRg As Range
    Dim xStr As String
    On Error Resume Next
    For Each xRg In Selection
    xStr = Replace(Cells(1, xRg.Value).Address(False, False), "1", "")
    xRg.Value = xStr
    Next
    End Sub
  • To post as a guest, your comment is unpublished.
    crystal · 2 years ago
    @Afzal Hi,
    Way not keep using the VBA code? The above VBA code can create letters from A to Z then AA to AZ and so on to meet your needs.
  • To post as a guest, your comment is unpublished.
    Dan · 2 years ago
    Is there a way to do this for entire words? Where every letter in the word moves up by X number of characters
  • To post as a guest, your comment is unpublished.
    Harold McBroom · 2 years ago
    Excel was the spreadsheet that superseded Lotus 1-2-3, and having been around that long, you would think that geniuses at Microsoft would have created a more simple means of retrieving a cells column number, without having to write your own function. Back in 2001, 2002 when I was programming in VBA there were only 65536 rows in an Excel spreadsheet, now the number has increased to a ridiculous 1.4 million rows. It's not how big the database is that counts, but how intelligent you manage the data on your hard drive, when accessing that data through Excel.

    If that doesn't make you upset, then the Bankers Rounding scheme used by Excel should finish the job! We were taught math in school, basic rounding, come to find out, the Bankers "guild" wants to determine how cash amounts are rounded to better cater to their advantages. For instance, 1.5 is either closer to 1 or 2, but is rounded up to 2, being the even number. 0.5 is either closer to 0 or 1, but being the odd number, they round it down to 0. The entire system is corrupt, and they create the business software used by American businesses.



    I read a comment below the one I'm addressing, and someone basically said, "I have a lot of banker friends, and they never heard of Bankers Rounding; They say they used a method called "5 Step Rounding" in the EU. So does that mean the Bankers Rounding is used only in the sabotage of the American Economy, but not good enough to ruin the European Economy that's trying to take over the world?! These money changers never cease to amaze me at how far they will go in their arrogance!
  • To post as a guest, your comment is unpublished.
    afzalss · 3 years ago
    Dear Sir
    When I run the function =ColLtrs(ROW()) in an excel sheet, I get perfect results, but if I want to call this function or cell value in VBA, then is it possible. So my variable could be i with values 1,2,3,4,....27,28, etc and result should be A,B,C,D....,AA,AB and so on. Is it possible?
    Thanks
  • To post as a guest, your comment is unpublished.
    Afzal · 3 years ago
    the formula =ColLtrs(ROW()) works perfectly well in an excel cell, I need to use the same inside a VBA to give me result from A to Z then AA to AZ and so on. If I use CHAR in VBA it has limitation to go only till Z.
  • To post as a guest, your comment is unpublished.
    cdarzur · 3 years ago
    @cdarzur Found the answer. Thank you.
    =LEFT(B1,4)&"_"&CHAR(CODE(RIGHT(B1,1))+1)
  • To post as a guest, your comment is unpublished.
    cdarzur · 3 years ago
    thank you for the above. But what if you want to increment from 400_A to 400_B? I tried a few things but I can only make it work with numbers.
    Thanks