View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default Grouping Cell Values Together

Highlight the three columns of data, including the headers, then Insert
| Name | Create and ensure that only Top Row is checked then OK - this
creates some named ranges. Then, assuming your data occupies columns A
to C, enter "Age" in E1, "Birch" in F1, and put 1 to 5 in cells E2 to
E6. Enter this array* formula in F2:

=SUM(IF((Age=$E2)*(Type=F$1),1,0))

*As this is an array formula, once you have typed it in (or
subsequently edit it) you have to use CTRL-SHIFT-ENTER (CSE) instead of
just ENTER. If you do this correctly, then Excel will wrap curly braces
{ } around the formula - you must not type these yourself.

You can then copy the formula to cells F3:F6.

This will give you the count of the number of Birch trees by the age
specified in column E. If you want a similar count for Maple, put
"Maple" in G1 and copy the formulae from F2:F6 into G2:G6, and
similarly for other tree types.

Hope this helps - not quite what you asked for, but useful for the
histograms.

Pete

steve65 wrote:
Hi All,

I wanted to create a histogram of the number of Birch trees by age
using the data below.

Height Age Type
4 2 Maple
4 2 Birch
1 3 Spruce
9 5 Spruce
5 1 Birch
1 3 Maple
10 3 Walnut
3 2 Spruce
7 4 Birch
1 2 Walnut
5 4 Pine
9 3 Walnut
2 5 Pine
2 3 Spruce
5 1 Maple
6 4 Pine
1 5 Birch
8 5 Walnut
10 5 Birch
9 3 Maple
3 1 Pine
9 4 Maple
4 3 Birch
8 1 Walnut
8 4 Maple
1 1 Maple
8 4 Birch
9 4 Maple
5 2 Pine
10 1 Maple

Is there a better way to group data together, like shown below, other
then using Data Filter?

Height Age Type
4 2 Birch
5 1 Birch
7 4 Birch
1 5 Birch
10 5 Birch
4 3 Birch
8 4 Birch

Steve


--
steve65
------------------------------------------------------------------------
steve65's Profile: http://www.excelforum.com/member.php...o&userid=37510
View this thread: http://www.excelforum.com/showthread...hreadid=571618