View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Totaling pre-defined groups?

I would use another column that groups my Heights.

I'm not quite sure how to determine the categories, though.

If you had said 38-44, 45-51, 52-58, ... (each group spanning 7 whole numbers),
you could use:

=INT((A1-3)/7)*7+3

Then 38-44 would be classified as 38.
45-51 would be 45
52-58 would be 52
.....

Then you could filter on that column.

=======
Another option would be to apply Data|pivottable.

You can group that data by a standard interval and see things like:

Sum of qty
Number Total
31-37 15
38-44 12
45-51 18
52-58 23
59-65 13
66-72 18
73-79 17
80-86 17
87-93 17
94-100 20
101-107 17

Add headers to row 1 (if you don't have them)
select the range A1:Bxxx
Data|pivottable
Follow the wizard until you get to a dialog with a Layout button on it.
Click that layout button
drag the header for the height to the Row field
drag the header for the units to the data field

And finish up the wizard.

Then rightclick on the Height button and choose Group and Show Detail, then
Group.
Then starting at 24 (say)
ending at 197 (or whatever you want)
by: 7

and watch the results.

(You could also do the categorization yourself and then use that in your
pivottable.

If you want to read more about pivottables...

Here are a few links:

Debra Dalgleish's pictures at Jon Peltier's site:
http://peltiertech.com/Excel/Pivots/pivottables.htm
And Debra's own site:
http://www.contextures.com/xlPivot01.html

John Walkenbach also has some at:
http://j-walk.com/ss/excel/files/general.htm
(look for Tony Gwynn's Hit Database)

Chip Pearson keeps Harald Staff's notes at:
http://www.cpearson.com/excel/pivots.htm

MS has some at (xl2000 and xl2002):
http://office.microsoft.com/downloads/2000/XCrtPiv.aspx
http://office.microsoft.com/assistan...lconPT101.aspx

nummel wrote:

I am not an excel wiz and I have a problem that is hard for me to solve. I
would like to total the # of units for a defined height range. For example:
how many units are within the height range of 38-44? or 46-51? I would like
to have a simple macro that references cell addresses for the min and max
height ranges I wish to total. Below is data examples. The auto filter
works ok, but I want have something that is not so labor intensive to re-use
over and over. I have lots of data and want to try many different
combinations. Thanks in advance...

height # units
38 193
39 318
40 716
41 961
42 997
43 1086
44 2169
45 1867
46 1413
47 1158
48 1017
49 876
50 733
51 401


--

Dave Peterson