跳到主要内容

如何在Excel中的单元格范围中添加前缀或后缀?

在某些情况下,有时您需要在所有单元格的开头或结尾添加通用文本。 当然,您可以将前缀或后缀一一添加到每个单元格中。 但是,当有许多单元时,工作会很费力。 本文将向您展示一些有关在Excel中轻松将前缀或后缀添加到所选单元格区域的提示。


使用公式将前缀或后缀添加到所有单元格

Excel的 串联 函数可以为单个单元格快速插入前缀或后缀。

1。 输入功能 =CONCATENATE("Food - ",A1) 细胞说,在一个空白的单元格中 C1,然后在要填充的范围内拖动此单元格的自动填充手柄。 并且所有单元格都已添加了特定的前缀文本。 参见屏幕截图:。 看截图:

您可以使用串联函数来插入前缀,后缀或后缀和前缀两者,如下所示:

输入公式 细胞结果
= Concatenate ("Food - ", A1) 食物-苹果
=Concatenate (A1, " - Fruit") 苹果-水果
=Concatenate ("Food - ", A1, " - Fruit") 美食–苹果-水果

轻松将常用文本添加到Excel中所有单元格(前缀或后缀)的开头或结尾

使用“自动填充”功能可以很容易地在列中填充具有相同内容的所有单元格。 但是,如何为列中的所有单元格添加相同的前缀或后缀? 比较分别为每个单元格键入前缀或后缀, Kutools for ExcelAdd Text 实用程序提供了一种简单的解决方法,只需单击几次即可完成。


广告添加文字前缀后缀

使用VBA向所有单元格添加前缀或后缀

您还可以使用以下VBA代码处理此问题:

1。 选择要插入前缀或后缀的范围。

2。 点击 Developer > Visual Basic,和一个新的 Microsoft Visual Basic for applications 显示窗口,单击 Insert > Module,然后输入以下代码:

VBA:在文本中添加前缀:

Sub AddTextOnLeft()
'Updateby20131128
Dim Rng As Range
Dim WorkRng As Range
Dim addStr As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
addStr = Application.InputBox("Add text", xTitleId, "", Type:=2)
For Each Rng In WorkRng
    Rng.Value = addStr & Rng.Value
Next
End Sub

VBA:在文本中添加后缀:

Sub AddTextOnRight()
'Updateby20131128
Dim Rng As Range
Dim WorkRng As Range
Dim addStr As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
addStr = Application.InputBox("Add text", xTitleId, "", Type:=2)
For Each Rng In WorkRng
    Rng.Value = Rng.Value & addStr
Next
End Sub

3。 然后点击 Run 按钮或按 F5 键来运行VBA。

4。 现在,请指定您要在其中添加前缀或后缀的范围 KutoolsforExcel 对话框,然后单击 OK 按钮,然后键入您将添加到第二个中的后缀或前缀 KutoolsforExcel 对话框,然后单击 OK 按钮。 请参阅以下屏幕截图:
     
现在已将指定的后缀或前缀添加到每个选定的单元格中,如下面的屏幕截图所示:


使用 Kutools for Excel 向所有单元格添加前缀或后缀

您可能不熟悉Excel中的功能和VBA代码。 和这个 Add Text 实用程序 Kutools for Excel 将帮助您快速将前缀或后缀插入任何选定范围。

Kutools for Excel - 包含 300 多个 Excel 基本工具。 享受全功能 30 天免费试用,无需信用卡! 现在下载!

1。 选择要添加前缀或后缀的单元格,然后单击  Kutools > Text > Add Text,请参见屏幕截图:

2。 在 Add Text 对话框中,输入您的前缀或后缀 文本 框,选中 Before first character 选项 (用于添加前缀),或 After last character 选项 (用于添加后缀),然后点击 Ok 按钮。
现在,指定的前缀或后缀立即添加到每个选定的单元格中。 看截图:


演示:使用 Kutools for Excel 向多个单元格添加前缀或后缀


Kutools for Excel:超过 300 个方便的工具触手可及! 立即开始 30 天免费试用,没有任何功能限制。 立即下载!

从Excel中的单元格的开头/右边/结尾删除前缀或后缀(相同的字符数)

Kutools for Excel's Remove By Position 此功能使您可以轻松地从单元格中文本字符串的开始/结束/指定位置删除前缀或后缀(某些字符)。


广告删除前缀后缀

相关文章

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!

Comments (24)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
hey,
I am doing product coding for some jeweler products but i dont know excel so much, i would like to ask a question to you with an example
like if i have any hoop earring so for earring my code id "E" and for hoop my code is "HP" and "23" for year in which design was made and "09" for the month in which the design was made and "001" for the sequence no of the design made in that month. i want to code it like "EHP2309001". could you please tell me a formula for that or do i need to prepare a different chart for it to use it with V lookup?
This comment was minimized by the moderator on the site
I have Product code which start from 1 to 99 but i want to add prefix that the product code should start from 0001 and end at 0099.
This comment was minimized by the moderator on the site
Hi, you can simply change the cell format for these cells by selecting them and pressing Ctrl + 1, and then selecting Custom on the Number tab, and typing "0000" in the Type: textbox.
This comment was minimized by the moderator on the site
asfdasdfawfe
This comment was minimized by the moderator on the site
How do I prefix a letter to a date in the format "Cmmddyy".

Example. A1 contains date in format mm/dd/yy (let's say 01/31/18)

I want A2 to show "C013118".
This comment was minimized by the moderator on the site
Use this formula in A2:
=IF(A1<>"","C"&IF(MONTH(A1)>=10,MONTH(A1),"0"&MONTH(A1))&DAY(A1)&RIGHT(YEAR(A1),2),"")
This comment was minimized by the moderator on the site
Hi, does any one how to add two numbers in one cell. For example, X 2.2 3.6 0.9 1.2 and I want to add each number with its rank, Like; X 2.2 (2) 3.6 (1) 0.9 (4) 1.2 (3) and these rank must be bold and with different colour.
This comment was minimized by the moderator on the site
thanks very much for KUTOOLS FOR EXCEL
This comment was minimized by the moderator on the site
I have filtered the cloumn and i have to apply TC001 till TC0209 on the filtered cells, could anyone please help me with this
This comment was minimized by the moderator on the site
i have single alphabets in different cell, say 10 cell with different....how can add these alphabets in one cell i.e. total no. of alphabets in one cell
This comment was minimized by the moderator on the site
arihhurthj hshsjsyshsj shshydjdj shshssj shshdj shshjddj Please tell me how to add new line with character GO after every line.
This comment was minimized by the moderator on the site
Need Help, I want to add character in Excell Example Cell No A1 Show A so next cell A2 show B I want to show B in next cell
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