跳到主要内容

如何在Excel中串联保持数字/日期格式?

您可能已经注意到,当我们在Excel中应用CONCATENATE函数时,日期格式(2014-01-03)和数字格式,例如货币格式($734.7),百分比格式(48.9%),小数点(24.5000)等内容被删除,并在连接结果中显示为通用数字。 在本文中,我们提出了几种解决方法,以在Excel中保留日期或数字格式来连接数据。


与Excel中的保留日期格式并置

本节讨论如何在Excel的CONCATENATE函数中保留日期格式。

1。 选择一个空白单元格,您将输出串联结果,然后输入公式 = CONCATENATE(TEXT(A2,“ yyyy-mm-dd”),“”,B2) (A2是您要连接日期的单元格,B2是您要连接日期的另一个单元格),然后按 输入 键。
doc串联保留日期数字格式2

2.继续选择连接结果单元格,然后根据需要将其“自动填充”手柄拖到范围内。 然后,您将看到指定的单元格被合并为一个单元格,同时保留了日期格式。 看截图:

备注:此公式 = CONCATENATE(TEXT(A2,“ yyyy-mm-dd”),“”,B2) 将任何日期格式的日期显示为 YYYY-MM-DD,如 2014-01-03。 要在CONCATENATE函数中保留其他日期格式,可以根据需要将yyyy-mm-dd更改为特定的日期格式代码。 如何获取日期/数字格式代码?

注意丝带 公式太难记了吗? 将公式另存为自动文本条目,以供日后再次使用!
阅读全文...     免费试用

批量合并多个单元格/行/列,而不会丢失Excel中的数据和日期/数字格式

通常,当使用 Excel 中的合并功能合并单元格时,它会删除除第一个单元格内容之外的所有单元格内容。但是,使用 Kutools for Excel 的 合并(行和列) 实用程序,您可以轻松地批量合并多个单元格/行/列,而不会丢失数据。 此外,该实用程序还支持组合结果中其余的原始日期格式和数字格式。 


Kutools for Excel - 使用 300 多种基本工具增强 Excel 功能。 享受全功能 30 天免费试用,无需信用卡! 立即行动吧!


与Excel中的保留编号(货币/百分比/小数位数)格式并置

本节讨论在Excel的CONCATENATE函数中保留数字格式,例如货币格式,百分比格式,数字的小数位等。

提示:如果您熟悉要连接的数字的格式代码,请单击 了解更多.

1。 首先,我们需要获取要连接的指定数字的格式代码:右键单击数字单元格,然后选择 单元格格式 从右键单击菜单中。 看截图:

2。 在打开的“设置单元格格式”对话框中,转到 联系电话 标签,点击 定制版 ,在 产品分类 框中,将格式代码复制到 Type 框,然后关闭“设置单元格格式”对话框。 看截图:
doc串联保留日期数字格式5

3。 然后,我们会将要连接的数字转换为文本字符串。 选择一个空白单元格(在我们的示例中为Cell E2),输入公式 = TEXT(B2,“ $#,## 0.00 _ ;;($#,## 0.00)”) (B2是您要连接的货币单元),然后按 输入 键。
doc串联保留日期数字格式6
:
(1)在上述格式中, $#,## 0.00 _);($#,## 0.00) 是我们在步骤2中复制的格式代码。您可以将格式代码更改为复制的格式代码。
(2)有时,您复制的货币格式代码可能非常复杂,从而导致公式错误。 如果是这样,请简单地输入格式代码,例如 $#,## 0.00 _);($#,## 0.00).

4。 如果要连接的数字种类繁多,请重复步骤1-3,将这些数字转换为文本字符串。

5。 将具有特殊数字格式的数字转换为文本字符串后,我们可以通过输入公式来集中它们 = CONCATENATE(A2,“”,E2,“”,F2) (A2,E2和F2是我们将要连接的单元格)成一个空白单元格(在我们的示例中为单元格G1),然后按 输入 键。 看截图:
doc串联保留日期数字格式7

6。 选择范围E2:G2,然后根据需要将自动填充手柄拖到该范围。 然后,您将看到每一行都已串联在一起,并保留了各种数字格式。 看截图:
doc串联保留日期数字格式8
备注:如果您熟悉要连接的数字格式代码,则可以应用公式 = CONCATENATE(A2,“”,TEXT(B2,“ $#,## 0.00 _);($#,## 0.00)”),“”,TEXT(C2,“ 0.00%”)) 并替换格式代码 $#,## 0.00 _);($#,## 0.00)0.00% 根据您的要求。

注意丝带 公式太难记了吗? 将公式另存为自动文本条目,以供日后再次使用!
阅读全文...     免费试用

使用 Kutools for Excel 连接并保持日期和数字格式

记不住日期和数字的格式代码,并且厌倦了重复复制它们? Excel 的 Kutools 结合 实用程序可以帮助您通过在Excel中单击几下来保持各种日期格式和数字格式来连接数据。

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

1。 选择要连接的范围,然后单击 库工具 > 合并与拆分合并行,列或单元格而不会丢失数据.
doc串联保留日期数字格式9

2。 在打开的“合并列或行”对话框中,请执行以下操作:
doc串联保留日期数字格式10
(1)检查 合并栏 在选项 根据以下选项合并选定的单元格 部分;
(2)在 指定分隔符 部分(我们检查了 太空 我们示例中的选项);
(3)指定放置串联结果的位置。 在我们的示例中,我们指定了 左细胞;
(4)在 附加选项 部分,我们检查 删除合并单元格的内容 选项;
(5)检查 使用格式化的值 该对话框底部的选项。

3。 点击 Ok 按钮以应用此实用程序。 然后,您将看到每一行都被串联到其第一个单元格中,并保留了各种日期格式和数字格式。 看截图:
doc串联保留日期数字格式12


演示:在Excel中连接保留数字/日期格式


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

相关文章:

最佳办公生产力工具

🤖 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 (29)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Yes! It’s working now. Thanks so much Amanda Lee
This comment was minimized by the moderator on the site
Amanda Lee I’ve tried that, it’s not helping.
This comment was minimized by the moderator on the site
Hi Joseph,

Nothing happened after you ran the code? Did you check if the sheet name and range name are right?
I just tried and the code works properly on my sheet.

Amanda
This comment was minimized by the moderator on the site
Can anyone please check why this code is not working?

Sub MergeFormatCell()
'Updateby Extendoffice
Dim xSRg As Range
Dim xDRg As Range
Dim xRgEachRow As Range
Dim xRgEach As Range
Dim xRgVal As String
Dim I As Integer
Dim xRgLen As Integer
Dim xSRgRows As Integer
Dim xAddress As String
On Error Resume Next
'xAddress = ActiveWindow.RangeSelection.Address
'Set xSRg = Application.InputBox("Please select cell columns to concatenate:", "KuTools For Excel", xAddress, , , , , 8)
'If xSRg Is Nothing Then Exit Sub
'Set xDRg = Application.InputBox("Please select cells to output the result:", "KuTools For Excel", , , , , , 8)
'If xDRg Is Nothing Then Exit Sub
Set xSRg = ActiveWorkbook.Sheets("Person List").Range("J2:Z142").Value
xSRgRows = xSRg.Rows.Count
Set xDRg = ActiveWorkbook.Sheets("Person List").Range("G2:G125").Value
Set xDRg = xDRg(1)
For I = 1 To xSRgRows
xRgLen = 1
With xDRg.Offset(I - 1)
.Value = vbNullString
.ClearFormats
Set xRgEachRow = xSRg(1).Offset(I - 1).Resize(1, xSRg.Columns.Count)
For Each xRgEach In xRgEachRow
.Value = .Value & Trim(xRgEach.Value) & " "
Next
For Each xRgEach In xRgEachRow
xRgVal = xRgEach.Value
With .Characters(xRgLen, Len(Trim(xRgVal))).Font
.Name = xRgEach.Font.Name
.FontStyle = xRgEach.Font.FontStyle
.Size = xRgEach.Font.Size
.Strikethrough = xRgEach.Font.Strikethrough
.Superscript = xRgEach.Font.Superscript
.Subscript = xRgEach.Font.Subscript
.OutlineFont = xRgEach.Font.OutlineFont
.Shadow = xRgEach.Font.Shadow
.Underline = xRgEach.Font.Underline
.ColorIndex = xRgEach.Font.ColorIndex
End With
xRgLen = xRgLen + Len(Trim(xRgVal)) + 1
Next
End With
Next I
End Sub
This comment was minimized by the moderator on the site
Hi there,

In the snippet below, you should delete ".Value"
Set xSRg = ActiveWorkbook.Sheets("Person List").Range("J2:Z142").Value
xSRgRows = xSRg.Rows.Count
Set xDRg = ActiveWorkbook.Sheets("Person List").Range("G2:G125").Value

Amanda
This comment was minimized by the moderator on the site
I am trying to update the month of a new company excel sheet and this is the issues I came across (=CONCATENATE(“Month 1 -“,TEXT($H$19,”d mmm yyyy”)) how do fix this
This comment was minimized by the moderator on the site
Hi there, you used the wrong quotation marks, please copy the formula below: =CONCATENATE("Month 1 - ",TEXT($H$19,"d mmm yyyy"))
Amanda
This comment was minimized by the moderator on the site
I have name in A column and in B column i have given today formula -1 i.e yesterday dateKnow i want every date to update name from A column and yesterday date
This comment was minimized by the moderator on the site
means? can explain bit more?
This comment was minimized by the moderator on the site
Thanks a lot ^^
This comment was minimized by the moderator on the site
Thank you very much, it helped me A LOT!
This comment was minimized by the moderator on the site
Hi How can I concatenate two date?10.06.2020 24.06.2020
This comment was minimized by the moderator on the site
Hi Gissu,
Do you mean to concatenate 10.06.2020 and 24.06.2020, and return 10.06.2020 24.06.2020? Or show the date with different style in the concatenaated results ?
Only if the combined data is date, you can apply the TEXT function ( TEXT(date, "mm.dd.yyyy") or TEXT(date, "dd.mm.yyyy") ) to convert the date to text while converting.
This comment was minimized by the moderator on the site
I have 789 records concatenated and I need to establish the frequency of the data, but I don't know how to get the class rank.
This comment was minimized by the moderator on the site
Hi Armando,

You can apply the Advanced Combine Rows feature of Kutools for Excel to get it done.

https://www.extendoffice.com/product/kutools-for-excel/excel-combine-duplicate-rows.html
This comment was minimized by the moderator on the site
concatenate but keep long date?
This comment was minimized by the moderator on the site
Hi NYC74,
For example, you need to concatenate the cell values in Cell A1 and B1, and B1 contains the date you will show as long date format in the concatenation result. Now you can use this formula:
=CONCATENATE(A1, " ", TEXT(B1,"dddd,mmmm dd, yyyy"))
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