# search and sum

#### audkb2002

##### New Member
Is there a way to search for matches and then sum other cells pertaining to those matched? Let's say I have rows and each has a column of classes (with AC, DC, DM) and a column of quantity. Is there a way to find all rows that = AC and add up all the quantities for AC?

AC 10
DC 10
DC 10
DM 10
AC 10

So basically, I want something to get the results AC=20, DC= 20, DM=10...

### Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

#### zacemmel

##### MrExcel MVP
On 2002-10-25 18:26, audkb2002 wrote:
Is there a way to search for matches and then sum other cells pertaining to those matched? Let's say I have rows and each has a column of classes (with AC, DC, DM) and a column of quantity. Is there a way to find all rows that = AC and add up all the quantities for AC?

AC 10
DC 10
DC 10
DM 10
AC 10

So basically, I want something to get the results AC=20, DC= 20, DM=10...

In C2 on enter: AC, DC, DM

In D2 enter & copy down:

=SUMIF(\$A\$2:\$A\$6,C2,\$B\$2:\$B\$6)

#### Mark W.

##### MrExcel MVP
Have a look at Exce's PivotTable functionality...
Book1
ABCDEFGHIJ
1ClassQuantitySumofQuantity
2AC10ClassTotal
3DC10AC20
4DC10DC20
5DM10DM10
6AC10GrandTotal50
7
8
Sheet5

Replies
6
Views
305
Replies
0
Views
367
Replies
5
Views
304
Replies
20
Views
666
Replies
18
Views
349

1,181,460
Messages
5,930,060
Members
436,718
Latest member
messa57fr

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back