跳到主要內容

如何在Excel中的單個單元格中計算逗號分隔的值?

如果單元格內容在單個單元格中用逗號分隔,例如“ A1,A2,A3,A4,A5”,並且您要計算該單元格中逗號分隔值的總數,該怎麼辦? 在這種情況下,總的逗號分隔值應為5。在本文中,我們將向您展示兩種在Excel中的單個單元格中計算逗號分隔值的方法。

用公式計算單個單元格中逗號分隔的值
使用出色的工具輕鬆計算單個單元格中逗號分隔的值

有關在Excel中進行計數的更多教程


用公式計算單個單元格中逗號分隔的值

以下面的屏幕截圖中的數據為例,請執行以下操作以計算範圍B3:B7中每個單元格中的逗號分隔值。

1.選擇一個空白單元格以輸出結果。

2.在其中輸入以下公式,然後按 Enter 鍵。 選擇結果單元格,然後拖動其 填充手柄 下來獲得所有結果。

=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1


使用出色的工具輕鬆計算單個單元格中逗號分隔的值

隨著 計算以逗號分隔的單元格數 的效用 Excel的Kutools,您可以輕鬆計算Excel中單元格中逗號分隔的值,而無需手動應用公式。

申請前 Excel的Kutools首先下載並安裝.

1.選擇一個空白單元格以輸出結果。

2。 轉到 庫工具 標籤,點擊 公式助手 > 公式助手。

3。 在裡面 公式助手 對話框,請進行以下配置。

  • 查找並選擇 計算用逗號分隔的值的數量 ,在 選擇一個公式 框;
    小提示: 你可以檢查 篩選 框中,鍵入某些單詞以過濾公式名稱。
  • 細胞 框,選擇要在其中計算逗號分隔值的單元格;
  • 點擊 OK 按鈕。 看截圖:

4.現在,結果將填充到所選單元格中。 選擇此結果單元格,然後向下拖動其“填充手柄”以獲取其他結果。 看截圖:

  如果您想免費試用(30天)此實用程序, 請點擊下載,然後按照上述步驟進行操作。


相關文章:

在Excel中計算一列中的重複值
如果您在工作表中有一個包含唯一值和重複值的數據列表,那麼您不僅要計算重複值的出現頻率,還想知道重複值出現的順序。 本文中的方法可以幫您一個忙。

用Excel中的文本或數字對單元格進行計數
例如,您有一個包含文本和數字的工作表,並且想要分別計算文本和數字的單元格總數,您會怎麼做? 在Excel中,可以使用公式來實現。 請瀏覽本教程以獲取更多詳細信息。

在Excel中計算單元格包含文本還是部分文本
假設您具有以下數據,並且想要分別計算包含文本“ Apple”的單元格數量,包含文本“ Orange”的單元格數量和包含“ Peach”的單元格數量,如何實現? 在本教程中,我們將詳細介紹COUNTIF函數,以幫助您快速計算單元格中包含文本或Excel中特定文本一部分的單元數。 此外,我們引入了一個很棒的功能,只需單擊即可輕鬆實現。

計算Excel中兩個值或日期之間的單元格數
如果您需要計算包含兩個數字或日期之間的特定值的單元格編號,CountIf函數的公式可以快速為您提供幫助。 在本教程中,我們將向您顯示計算Excel中兩個值或日期之間的單元格數量的詳細信息。

最佳辦公生產力工具

🤖 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 (12)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
To not show blank cells as 1, add an if statement using ISBLANK in the condition:=IF(ISBLANK(A1),0,LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+1)

or, if you prefer to avoid IF logic blocks in your sheet, use SIGN and LEN:=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+SIGN(LEN(A1))


This comment was minimized by the moderator on the site
It returns a count of 1 from an empty cell. How do you fix this so it returns the count of zero??
This comment was minimized by the moderator on the site
what if some of the cells only have one value, e.g. cell A = KTW, cell B = VAL, SME how to count cell A?
This comment was minimized by the moderator on the site
How To Count Comma Separated Specific Values in a single cell In Excel?
Suppose to count how many 15's are there in a single cell that contains 10,1,15,20,15,5,15,155
I need the result 3.
Is there any formula in excel
This comment was minimized by the moderator on the site
This worked great for me but i had to edit formula for Office 2016. (TRIM(A1),",","")) replaced with (TRIM(A1);",";""))
This comment was minimized by the moderator on the site
Dear Shandoo,

Thank you for your supplement!
This comment was minimized by the moderator on the site
i have comma separated values in cells like A=1,2,3,4,5,6 B=3,4,5,6,7,8 I want to add the contents of the two cells without repeating the value and also want to get the common value of two cells expected result = 1,2,3,4,5,6,7,8 =3,4,5,6 i am not getting the exact formula in microsoft excel 2013 Kindly help me Thanks
This comment was minimized by the moderator on the site
have you found out the way to achieve this? i am looking for exactly the same thing. thanks
This comment was minimized by the moderator on the site
i too looking for the same
This comment was minimized by the moderator on the site
What if some of the cells underneath are blank? When using the fill handle on the rest of the cells it's coming up with 1 as the total.
This comment was minimized by the moderator on the site
Hello James55, don't know if you ever got an answer but in case you need one. Use an IF statement to check if the cell is blank and then print a "0" or null "" whichever you like. =IF(A1="","0",(LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1),",",""))+"1"))
This comment was minimized by the moderator on the site
Great share info
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations