View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pete Pete is offline
external usenet poster
 
Posts: 193
Default Database summary



"Todd Vohs" wrote:

I have a workbook with 2 spreadsheets. In the first one, I have a column of
products that has a corresponding customer and the customer may appear more
than once. I want to query that sheet and in the second sheet, have the
customer list with the sum of quantity of products that customer purchased.
All products are equivalent in size just different genetics. I just want to
know how many each customer purchased.

Sheet 1
customer1 product1 qty
customer2 product1 qty
customer2 product2 qty
customer2 product3 qty
customer3 product1 qty
customer3 product2 qty
customer4 product1 qty
customer4 product2 qty

Sheet 2
customer1 sum
customer2 sum
customer3 sum
cusomter4 sum



Hi. I think that you could use the "SUMIF" function. If,say, the customer
names are in column A, rows 1 to 10, and their purchases are in column B,
rows 1 to 10, then you could run a search thus :

Label A11 to A20 Customer 1, Customer2, & etc..

In cell B11, code : =sumif(A1:A10,"Customer 1",B1:B10)

In cell B11 you will then have the sum (taken from column B (rows 1 to 10))
of any name and column A (rows 1 to 10) which matches the target name (in
this first case, Customer 1)

In cell B12, code: =sumif(A1:A10,"Customer 2",B1:B10)
In cell B13, code: =sumif(A1:A10,"Customer 3",B1:B10)

I hope this helps