跳到主要內容

如何在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是您要連接日期的另一個單元格),然後按 Enter 鍵。
doc串聯保留日期數字格式2

2.繼續選擇連接結果單元格,然後根據需要將其“自動填充”手柄拖到範圍內。 然後,您將看到指定的單元格被合併為一個單元格,同時保留了日期格式。 看截圖:

備註:此公式 = CONCATENATE(TEXT(A2,“ yyyy-mm-dd”),“”,B2) 將任何日期格式的日期顯示為 YYYY-MM-DD2014-01-03。 要在CONCATENATE函數中保留其他日期格式,可以根據需要將yyyy-mm-dd更改為特定的日期格式代碼。 如何獲取日期/數字格式代碼?

注意絲帶 公式太難記了嗎? 將公式另存為“自動文本”條目,以供日後再次使用!
閱讀全文...     免費試用

批量合併多個單元格/行/列,而不會丟失Excel中的數據和日期/數字格式

通常,使用Excel中的“合併”功能合併單元格時,它將刪除除第一個單元格內容以外的所有單元格內容。 但是,使用Kutools for Excel的 合併(行和列) 實用程序,您可以輕鬆地批量合併多個單元格/行/列,而不會丟失數據。 而且,該實用程序還支持組合結果中其餘的原始日期格式和數字格式。 


Excel的Kutools - 使用 300 多種基本工具增強 Excel 功能。 享受全功能 30 天免費試用,無需信用卡! 立即行動吧!


與Excel中的保留編號(貨幣/百分比/小數位數)格式並置

本節討論在Excel的CONCATENATE函數中保留數字格式,例如貨幣格式,百分比格式,數字的小數位等。

提示:如果您熟悉要連接的數字的格式代碼,請單擊 這裡.

1。 首先,我們需要獲取要連接的指定數字的格式代碼:右鍵單擊數字單元格,然後選擇 單元格格式 從右鍵單擊菜單中。 看截圖:

2。 在打開的“設置單元格格式”對話框中,轉到 聯繫電話 標籤,點擊 習俗 ,在 類別 框中,將格式代碼複製到 類別 框,然後關閉“設置單元格格式”對話框。 看截圖:
doc串聯保留日期數字格式5

3。 然後,我們會將要連接的數字轉換為文本字符串。 選擇一個空白單元格(在我們的示例中為Cell E2),輸入公式 = TEXT(B2,“ $#,## 0.00 _ ;;($#,## 0.00)”) (B2是您要連接的貨幣單元格),然後按 Enter 鍵。
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),然後按 Enter 鍵。 看截圖:
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一起保持日期和數字格式

記不住日期和數字的格式代碼,並厭倦重複複製它們? Kutools for Excel的 結合 實用程序可以幫助您通過在Excel中單擊幾下來保持各種日期格式和數字格式來連接數據。

Excel的Kutools - 包含 300 多個 Excel 基本工具。 享受全功能 30 天免費試用,無需信用卡! 現在下載!

1。 選擇要連接的範圍,然後單擊 庫工具 > 合併與拆分合併行,列或單元格而不會丟失數據.
doc串聯保留日期數字格式9

2。 在打開的“合併列或行”對話框中,請執行以下操作:
doc串聯保留日期數字格式10
(1)檢查 合併欄 在選項 根據以下選項合併選定的單元格 部分;
(2)在 指定分隔符 部分(我們檢查了 宇宙 我們示例中的選項);
(3)指定放置串聯結果的位置。 在我們的示例中,我們指定了 左細胞;
(4)在 選項 部分,我們檢查 刪除合併單元格的內容 選項;
(5)檢查 使用格式化的值 該對話框底部的選項。

3。 點擊 Ok 按鈕以應用此實用程序。 然後,您將看到每一行都被串聯到其第一個單元格中,並保留了各種日期格式和數字格式。 看截圖:
doc串聯保留日期數字格式12


演示:在Excel中連接保留數字/日期格式


Excel的Kutools:超過 300 個方便的工具觸手可及! 立即開始 30 天免費試用,沒有任何功能限制。 現在就下載!

相關文章:

最佳辦公生產力工具

🤖 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 (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