跳到主要內容

如何在Excel中按組對值求和?

這是兩列,一列是產品名稱,另一列是銷售。 現在,我想用相同的產品來匯總銷售,如下圖所示。 如何在Excel中解決?
第1組的文檔總和

使用公式按組求和

使用Kutools for Excel按組計算或合併值


使用公式按組求和

您可以在Excel中輕鬆地使用一個公式按組對值求和。

選擇數據范圍的下一個單元格,鍵入 = IF(A2 = A1,“”,SUMIF(A:A,A2,B:B)),(A2是您要基於的相對像元,A1是列標題,A:A是要基於其求和的列,B:B是您要對這些值求和的列。) Enter 鍵,將填充手柄向下拖動到單元格以填充公式。
第2組的文檔總和


使用Kutools for Excel按組計算或合併值

如果要按組進行其他計算,例如計數,查找最大值或最小值或根據組合併值,則可以嘗試 Excel的Kutools高級合併行 效用。

Excel的Kutools, 與以上 300 方便的功能,使您的工作更加輕鬆。 

免費安裝 Kutools for Excel,請執行以下操作:

1.選擇數據范圍,然後單擊 庫工具 > 合併與拆分 > 高級合併行.
第3組的文檔總和

2。 在裡面 高級合併行 對話框,請按以下步驟操作:

1)指定一列作為用於計算或組合值的關鍵列;

2)根據需要在一個操作中選擇一個選項。
第4組的文檔總和

3。 點擊 Ok,則將按以下屏幕截圖所示計算或組合這些值:

 按組求和  按組合併
第5組的文檔總和   第6組的文檔總和

最佳辦公生產力工具

🤖 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 (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
hi what if the date is also added to it and then how we can calculate total for particular item, date wise. see below
Date item qty
3-Mar-21 blue 24
3-Mar-21 green 15
3-Mar-21 green 46
3-Mar-21 Blue 54
3-Mar-21 Red 6
4-Mar-21 Red 18
4-Mar-21 Blue 21
4-Mar-21 green 39
4-Mar-21 green 52
4-Mar-21 red 35
4-Mar-21 blue 19
5-Mar-21 green 54
5-Mar-21 green 26
5-Mar-21 Blue 29
5-Mar-21 Red 31
5-Mar-21 Red 74
5-Mar-21 Blue 20
5-Mar-21 green 85
5-Mar-21 green 56
This comment was minimized by the moderator on the site
Not exactly working for me. The A1 in the A2=A1 is does not stay constant once pasted and is off always by one row. If I lock the cell, in my case =IF(A2=$A$1,"",SUMIF(A:A,A2,H:H)), The formula works but populates in every column cell.
This comment was minimized by the moderator on the site
How use =IF(A2=A1,"",SUMIF(A:A,A2,B:B))
If in coloumn A data Blue is come after black
This comment was minimized by the moderator on the site
Please Reply
This comment was minimized by the moderator on the site
You can sort the data firstly to make sure that same data together.
This comment was minimized by the moderator on the site
Sum Values By Group. Nice to have a good reference for users not familiar with excel formula scripting. I have used the same script but I cannot find a way to sort the result based on the summed values, in your example, I like to get summed valued from highest to lowest (105, 96, 83). I was able to do it by creating another column (say column D) to copy the summed amount corresponding to product (say, Blue will have 96 for D2, D3, D4 / 83 for D5, D6 and so on) then sort column D. But I think that is a crude way of doing it. Is there a built-in function in Excel or Kutools to have the sum and sort (based on summed values). Thanks
This comment was minimized by the moderator on the site
Skip the IF part and just use =SUMIF(A:A,A2,B:B)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations