count values in a column, but. . .
Try this array formula**.
Data in the range A2:B7. There are no empty cells *within* the person name
range A2:A7.
D2:D4 = list of unique town names: town1, town2, town3
Enter this array** formula in E2 and copy down to E4:
=SUM(IF(FREQUENCY(IF(B$2:B$7=D2,MATCH(A$2:A$7,A$2: A$7,0)),ROW(A$2:A$7)-ROW(A$2)+1),1))
** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT
key then hit ENTER.
--
Biff
Microsoft Excel MVP
"tree" wrote in message
...
First, apologies: My question must be answered in this and countless
other
forums, but I can scarcely even begin to 'formulate' my question in search
syntax. So here goes.
I have a table with the columns Name (of people) and Town. (There are
other
columns, but these are the two I'm concerned with.) I want to count the
number of people there are for each Town, but count each person only once.
For instance -
NAME TOWN
person1 town1
person1 town1
person2 town1
person3 town2
person3 town2
person4 town3
The results I'm looking for would be -
TOWN COUNT (of individual people)
town1 2
town2 1
town3 1
Thanks.
|