How to sum values based on criteria in another column in Excel?
Sometimes you want to sum the values based on criteria in another column, for instance, here I only want to sum up the "Sale Volume" column where the corresponding "Product" column equals "A" as show as below, how can you do it? Of course, you can sum them one by one, but here I introduce some simple methods for you to sum the values in Excel.
In Excel, you can use formulas to quickly sum the values based on certain criteria in an adjacent column.
1. Copy the column you will sum based on, and then pasted into another column. In our case, we copy the Fruit column and paste in Column E. See screenshot left.
2. Keep the pasted column selected, click Data > Remove Duplicates. And in the popping up Remove Duplicates dialog box, please only check the pasted column, and click the OK button.
3. Now only unique values are remained in the pasted column. Select a blank cell besides the pasted column, type the formula =SUMIF($A$2:$A$24, D2, $B$2:$B$24) into it, and then drag its AutoFill Handle down the range as you need.
And then we have summed based on the specified column. See screenshot:
Note: In above formula , A2:A24 is the column whose values you will sum based on, D2 is one value in the pasted column, and B2:B24 is the column you will sum.
Besides using formula, you also can sum the values based on criteria in another column by inserting a Pivot table.
1. Select the range you need, and click Insert > PivotTable or Insert > PivotTable > PivotTable to open the Create PivotTable dialog box.
2. In the Create PivotTable dialog box, specify the destination rang you will place the new PivotTable at, and click the OK button.
3. Then in the PivotTable Fields pane, drag the criteria column name to the Rows section, drag the column you will sum and move to the Values section. See screenshot:
Then you can see the above pivot table , it has summed the Amount column based on each item in the criteria column. See screenshot above:
Sometimes, you may need to sum values based on criteria in another column, and then replace original data with the sum values directly. You can apply Kutools for Excel's Advanced Combine Rows utility.
1. Select the range that you will sum values based on criteria in another column, and click Kutools > Content > Advanced Combine Rows.
Please note that the range should contain both the column you will sum based on and the column you will sum.
2. In the opening Combine Rows Based on Column dialog box, you need to:
(1) Select the column name that you will sum based on, and then click the Primary Key button;
(2) Select the column name that you will sum, and then click the Calculate > Sum.
(3) Click the Ok button.
Now you will see the values in the specified column are summed based on the criteria in the other column. See screenshot above:
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 7 months agowow, thank you so much, i learnt a new thing from ua article, it helped me a lot & saved lot of my time
- To post as a guest, your comment is unpublished.· 1 years agoif two coulumn have same fruit then add them like this
apple orange grapes apple
2 4 5 7
5 4 3 23
21 3 34 22
then i would like to add total no. of apples
can this be done by any formula or some tricks
- To post as a guest, your comment is unpublished.· 1 years agoHi Surat,
What about adding the total number manually?
Holding the SHIFT key, select both Apple columns simultaneously, and then you will get the total number in the status bar.
- To post as a guest, your comment is unpublished.· 1 years agoHi. I have two types of Payments in cell G5:G51 ("Security" and "Rental"). The amount is in cell H5:H51. I wan to sum up all the security Payments in Cell K5 and All Rental Payments in Cell K6. How can I do it.
- To post as a guest, your comment is unpublished.· 2 years agothanks for the excellent - quick & easy instructions for creating totals based on "distinct" values
- To post as a guest, your comment is unpublished.· 4 years agoI want sum
FABRICS 2014> 16.90 mtr
N-15FLAT011W/O STONES(BLUE) 16.90 mtr
FNC 2014 >
N-MT#28-#4(SILVER) 11.50 mtr
N-MT#5-#7(SKY BLUE) 28.90 mtr
M-FML-A478(RED) 6.79 mtr
N-PR-#8961-(PINK) 18.30 mtr
- To post as a guest, your comment is unpublished.· 5 years agoI need to count the names listed in Colum B if column D meets a criteria. What formula should I use?
- To post as a guest, your comment is unpublished.· 5 years agoI tried this but it generates an error. I have values ranging from 0-10 in column C and Values ranging from 100 - 12000 in Column D. I want to sum only those values in column D, whose corresponding value in Column C is greater than 0 (any value grater than 0). But when I enter >0 as the criteria in the above, it throws an error =SUMIF(C13:C7535, >0, D13:D7535)
- To post as a guest, your comment is unpublished.· 3 years agoYou need to put parenthesis around the >0, so it should be ">0"
- To post as a guest, your comment is unpublished.· 6 years agoI need a formula to find the maximum value in column 2 based on the value available in the column 1
for ex, I have value "TC001" repeated for 4 times in columnA and the corresponding values in Column B will be as shown below
Column A Column B
I need a formula to find the max value in column B. The max value in column B in this example is "BASE_1108ST"
Could anyone please help.