# add cells with the same criteria

#### fahimip

##### New Member
HI

i need to write code for a list of cells which have the following column headings; NAME and QUANTITY .
what i want is for the code to filter the list so that any quantities for the same name are added together

thank u

### Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.

#### SteveO59L

##### Well-known Member
Create a unique list from your names, using an advanced filter. Then use sumif() with the unique list as the criteria.

#### fahimip

##### New Member
Hi Steve

Im a little confused as to what i should use as the range and criteria when im using SumIF

this is the list that i have;

Code Qty
M/A/012 2
M/A/07 4
M/A/12 89
M/B/01 6
M/B/02 1
M/B/04 4
M/B/07 1
M/B/10 3
M/B/12 4
M/B/13 25
M/B/13 1
M/B/17 3
M/B/18 8
M/I/10 2
M/I/13 5
M/I/14 1
M/S/07 14
M/S/18 6
M/S/12 12
M/S/18 2
M/S/20 5
M/S/21 11

#### fahimip

##### New Member
i dont know if ive been clear enough, what i want to do is if two cells have the same 'code' then i would like these cells to be merged and their respective quantities to be added together

Replies
1
Views
31
Replies
0
Views
38
Replies
1
Views
28
Replies
3
Views
206
Replies
2
Views
95