Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old May 18th 05, 09:23 PM
BLW
 
Posts: n/a
Default summing an array by product category

I need help writing a macro that will look down the first column and will add
up the prices of whatever rows that have the same category.

Example:
category product price
pets horse 100
pets dog 50
food banana .50
food hamburger 1.50

pets subtotal: 150
food subtotal: 2.00

Thank you very much.

BLW



  #2   Report Post  
Old May 18th 05, 09:33 PM
Andy B
 
Posts: n/a
Default

Hi
It is possible to do this without a macro using SUMPRODUCT or SUMIF. If you
don't specifically need a macro, post back and we'll respond for you!

Andy.

"BLW" wrote in message
news
I need help writing a macro that will look down the first column and will
add
up the prices of whatever rows that have the same category.

Example:
category product price
pets horse 100
pets dog 50
food banana .50
food hamburger 1.50

pets subtotal: 150
food subtotal: 2.00

Thank you very much.

BLW




  #3   Report Post  
Old May 18th 05, 09:40 PM
Peo Sjoblom
 
Posts: n/a
Default

oTry a pivot table, it will give you this, in the layout drag the category
header in the row field and the price to the data field


http://peltiertech.com/Excel/Pivots/pivotstart.htm



Regards,

Peo Sjoblom

"BLW" wrote:

I need help writing a macro that will look down the first column and will add
up the prices of whatever rows that have the same category.

Example:
category product price
pets horse 100
pets dog 50
food banana .50
food hamburger 1.50

pets subtotal: 150
food subtotal: 2.00

Thank you very much.

BLW


  #4   Report Post  
Old May 18th 05, 09:59 PM
BLW
 
Posts: n/a
Default

Andy, I don't specifically need to use a macro so long as I can continually
select more products and the subtotals change with the new selection. In any
case, I would like to see how the two functions you described are use.
Thanks a lot

"Andy B" wrote:

Hi
It is possible to do this without a macro using SUMPRODUCT or SUMIF. If you
don't specifically need a macro, post back and we'll respond for you!

Andy.

"BLW" wrote in message
news
I need help writing a macro that will look down the first column and will
add
up the prices of whatever rows that have the same category.

Example:
category product price
pets horse 100
pets dog 50
food banana .50
food hamburger 1.50

pets subtotal: 150
food subtotal: 2.00

Thank you very much.

BLW





  #5   Report Post  
Old May 18th 05, 11:13 PM
Bob Phillips
 
Posts: n/a
Default

=SUMPRODUCT(--(A1:A100="pets"),C1:C100)

or

=SUMIF(A1:A100,"pets",C1:C100)

--
HTH

Bob Phillips

"BLW" wrote in message
...
Andy, I don't specifically need to use a macro so long as I can

continually
select more products and the subtotals change with the new selection. In

any
case, I would like to see how the two functions you described are use.
Thanks a lot

"Andy B" wrote:

Hi
It is possible to do this without a macro using SUMPRODUCT or SUMIF. If

you
don't specifically need a macro, post back and we'll respond for you!

Andy.

"BLW" wrote in message
news
I need help writing a macro that will look down the first column and

will
add
up the prices of whatever rows that have the same category.

Example:
category product price
pets horse 100
pets dog 50
food banana .50
food hamburger 1.50

pets subtotal: 150
food subtotal: 2.00

Thank you very much.

BLW









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summing up data with an array formula Kofi Excel Worksheet Functions 3 May 10th 05 09:50 PM
Summing an array based on text condition RestlessAde Excel Discussion (Misc queries) 3 April 21st 05 05:44 PM
Help needed with cell category, ie Number/Text etc Martc Excel Discussion (Misc queries) 6 April 18th 05 01:20 PM
How to set a formula to count the product appear how manytime AMY Excel Worksheet Functions 3 March 21st 05 09:49 AM
Which function(s)? LB Excel Worksheet Functions 3 January 5th 05 06:19 PM


All times are GMT +1. The time now is 12:04 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017