Condensing a list with duplicates to a list with non-duplicates

N

Nuclear

Assume I have this list

FOOD QUANTITY

carrots 2
pears 1
apples 3
carrots 1
apples 2

How do I create another column that lists AUTOMATICALLY the distinct FOOD's
listed and their quantities... Like so:

FOOD Total Quantity

carrots 3
pears 1
apples 5
 
J

John

I'm no expert, but I would use the Sumif() function. This would depend on
how many unique food items you have. Beside your table of items (or on a
separate sheet) put:

D1: Food
D2: Carrots
D3: Pears
D4: Apples

Assuming your table is A1:B100 (A2 to A100 has food and B2 to B100 has count)

In D2 to D3 list your unique foods (as above). In E2 put the the formula:

=SUMIF($A$2:$A$100,D2,$B$2:$B$100)

Then copy this down to E3. What is does is sums only values in the table
that have the value in D2, D3...

Hope this help...
 
M

M Kan

You could just use a pivot table with FOOD in the Row and SUM of QUANTITY in
the data section.

If you need more analysis or manipulation and your list is long, you can
still use a Pivot table on FOOD to generate a list of unique values and then
use that as the key for SUMIFs, COUNTIF, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top