Note: The other languages of the website are Google-translated. Back to English
登陆  \/ 
x
or
x
点此注册  \/ 
x

or

如何在Excel中自动增加一个字母以获得下一个字母?

假设您有一个包含字母AB的单元格,则需要将最后一个字母加XNUMX,以获取下一个字母AC,AD…,依此类推。 或者,您有一个字母A,并且想要将该字母增加到B,C…以创建一个字母列表。 如何实现呢? 本文可以为您提供详细信息。

用公式将字母AB加XNUMX以得到AC,AD…
将字母增加一个以获取具有公式的字母列表
使用用户定义的功能将字母增加XNUMX以获取字母列表


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

请按照以下步骤在Excel中将字母增加XNUMX。

1.在给定字母下方选择一个空白单元格,在其中输入以下公式,然后按 输入 键。 

=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以获取具有公式的字母列表

您可以使用 = CHAR(CODE(A1)+1) 在Excel中将字母加XNUMX的公式。 请执行以下操作。

1.在给定字母下方选择一个空白单元格,输入公式 = CHAR(CODE(A2)+1) 进入编辑栏,然后按 输入 键。 看截图:

2.选择结果单元格,向下拖动“填充手柄”以获取所需的字母。

备注:使用此公式,得到字母Z后,如果继续向下拖动Fill Handle,将会得到一些特殊字符,如下图所示。 如果要在Z后面获得字母AA,可以使用以下用户定义的函数来帮助您。


使用用户定义的功能将字母增加XNUMX以获取字母列表

以下用户定义的函数还可以帮助您在Excel中将字母增加XNUMX。

1。 按 其他 + F11 同时打开 Microsoft Visual Basic应用程序 窗口。

2。 在里面 Microsoft Visual Basic应用程序 窗口中,单击 插页 > 模块。 然后将以下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应用程序 窗口。

4.在给定字母下方选择一个空白单元格,输入公式 = ColLtrs(ROW()),然后按 输入 获得第二个字母的钥匙。

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 · 2 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.
    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.
    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.
      Me · 2 years ago
      Everything man does is corrupt. Everything.
  • 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.
      crystal · 2 years ago
      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.
    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.
      crystal · 2 years ago
      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.
    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
    • To post as a guest, your comment is unpublished.
      cdarzur · 3 years ago
      Found the answer. Thank you.
      =LEFT(B1,4)&"_"&CHAR(CODE(RIGHT(B1,1))+1)