跳到主要內容

如何在Excel中基於文本條件求和?

在Excel中,您是否曾經嘗試過根據另一列文本條件求和? 例如,我在工作表中有一系列數據,如下面的屏幕快照所示,現在,我想將B列中與滿足特定條件的A列中的文本值相對應的所有數字加起來,例如,如果列A中的單元格包含KTE。

基於文本的文檔和 1

如果包含某些文本,則基於另一列求和

如果以某些文本開頭,則基於另一列求和

如果以某些文本結尾,則基於另一列求和

如果只有某些文本,則基於另一列求和


箭頭藍色右氣泡 如果包含某些文本,則基於另一列求和

讓我們以上面的數據為例,將所有包含A列中文本“ KTE”的值加在一起,以下公式可能會為您提供幫助:

請輸入此公式 = SUMIF(A2:A6,“ * KTE *”,B2:B6) 放入空白單元格,然後按 Enter 鍵,那麼B列中A列中相應單元格包含文本“ KTE”的所有數字將加起來。 查看屏幕截圖:

基於文本的文檔和 2
-1
基於文本的文檔和 3

尖端:在以上公式中, A2:A6 是您根據其添加值的數據范圍, * KTE * 代表您需要的條件,B2:B6是您要求和的範圍。


箭頭藍色右氣泡 如果以某些文本開頭,則基於另一列求和

如果您只想對B列中的單元格值求和,其中A列中相應的單元格以“ KTE”開頭,則可以應用以下公式: = SUMIF(A2:A6,“ KTE *”,B2:B6),請參見屏幕截圖:

基於文本的文檔和 4
-1
基於文本的文檔和 5

尖端:在以上公式中, A2:A6 是您根據其添加值的數據范圍, KTE * 代表您需要的條件,而B2:B6是您要求和的範圍。


箭頭藍色右氣泡 如果以某些文本結尾,則基於另一列求和

若要將B列中文本以“ KTE”結尾的A列中的相應單元格的所有值相加,此公式可為您提供幫助: = SUMIF(A2:A6,“ * KTE”,B2:B6)A2:A6 是您根據其添加值的數據范圍, KTE * 代表您需要的標準,並且 B2:B6 是您要求和的範圍)請參見屏幕截圖:

基於文本的文檔和 6
-1
基於文本的文檔和 7

箭頭藍色右氣泡 如果只有某些文本,則基於另一列求和

如果您只想對B列中的值進行求和,而B列中相應的單元格內容僅是A列的“ KTE”,請使用以下公式: = SUMIF(A2:A6,“ KTE”,B2:B6)A2:A6 是您根據其添加值的數據范圍, KTE 代表您需要的標準,並且 B2:B6 是您要求和的範圍),然後在A列中只有文本是“ KTE”,B列中的相對數字將累加起來,請參見屏幕截圖:

基於文本的文檔和 8
-1
基於文本的文檔和 9

高級合併行:(合併重複的行並求和/平均對應的值):
  • 1.指定要基於其合併其他列的鍵列;
  • 2.為您的合併數據選擇一種計算。

doc-sum-columnsone-criteria-7

Excel的Kutools:具有200多個方便的Excel加載項,可以在60天內免費試用,沒有任何限制。 立即下載並免費試用!


相關文章:

如何在Excel中每n行向下求和?

如何在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 (22)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I try already.cause I apply the whole range it's still could not get the total sum. I am used sumif
This comment was minimized by the moderator on the site
i need to reference my sumifs criteria to a specific cell, the cell acts as a filter
EG: =SUMIFS(LV215:LV237,WC7,AB215:AB237) where WC7 is equal to a specific cell is this possible?
This comment was minimized by the moderator on the site
i cannot find this tool. "Combine Rows Based on Column" at the top of the page. i also cannot find info on what is on the free version vs. what is on the paid version. is this on the paid version? if not, where is it? thanks!
This comment was minimized by the moderator on the site
Hello, jenna,
We have moved this feature under the Merge & Split group, please see the below screenshot.
Sorry for this inconvenience.
Please try, thank you!
This comment was minimized by the moderator on the site
I create a dynamic string which contains the cells to sum and pass this string to sum function and it gives me #value error. Any solution to this.
This comment was minimized by the moderator on the site
Hi, Desu,
Could you give your problem more detailed, thank you!
This comment was minimized by the moderator on the site
By the way, I’m using the =SUMIF(A2:A6,"*KTE*",B2:B6) formula, and I want to do more than just the B column (up to column AM).
This comment was minimized by the moderator on the site
Hello, Paige,
For solving your problem, may be there is no simple formula, you should join the SUMIF function together to get the result as you need, for example, you can use the below formula: (you can add other columns data with combining the sumif function)

=SUM(SUMIF(A2:A6,"*kte*",B2:B6), SUMIF(A2:A6,"*kte*",C2:C6), SUMIF(A2:A6,"*kte*",D2:D6))

Please try it, hope it can help you!
This comment was minimized by the moderator on the site
This works but what if I want to use the last part of the formula to cover multiple columns instead of just one?
This comment was minimized by the moderator on the site
how do I use a sumif in the following. If a certain cell contains the values of an substring of data, than sum a nearby column. for example, Cell A1 has (Dan,Tom,Bill,Smith). Then a separate table has Dan - 2, Bill - 3, John - 4. Assuming that is a 2x3 table. I want to create a formula that can sum the Dan and Bill numbers (2+3) because those texts could be found in cell A1. So the total would return 5.
This comment was minimized by the moderator on the site
How do you us sumif formula to with two criteria? For instance, If Column A = X and Column C = C then Sum Column G.
This comment was minimized by the moderator on the site
Hello, Matusiak
To sumif values based on multiple criteria, please view the following screenshot:

Also, you can go to the article https://www.extendoffice.com/documents/excel/2471-excel-sumif-multiple-criteria.html to get your solution.
This comment was minimized by the moderator on the site
Hi, any one here is having an idea of how to calculate value containing in a cell (Or with text?
For Example: in Cell A= MR134 , B= MR143, C = MR187 and result will be like sum of 134+143+187 =?
This comment was minimized by the moderator on the site
I am looking for this solution too.
This comment was minimized by the moderator on the site
Hello, guys,
May be the below array formula can help you: (after typing the formula, please press Ctrl+Shift+Enter together)
=SUM(IF(ISNUMBER(SEARCH("MR",B1:B4)),SUBSTITUTE(B1:B4,"MR",""))+0)
Please change the cell references to your need.
This comment was minimized by the moderator on the site
This is super clear and understandable, thank you so much!!!
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