Luiz:
Your problem arises from the fact that your table is not fully normalized.
The table should be decomposed into two tables one containing each person
once only (their name address etc), the other containing the calls (the date,
subject etc). The Calls table should contain a foreign key column which
references the primary key of the People table. These columns should be
unique numeric PersonID values rather than the names as two people might have
the same name. The primary key of the People table can be an autonumber, but
the corresponding foreign key in the Calls table should be a straightforward
long integer number data type.
The two separate tables can be populated from the original table by means of
'append' queries. First create the two new empty tables. Then append the
distinct people from the original table to the new People table first. Then
join the original table to the new People table on the Name columns and
append the PersonID, CallDate etc columns to the new Calls table
For data input of calls use a form in which a combo box is bound to the
foreign key PersonID column, but shows the names from the People table in its
list (the combo box wizard can set this up for you).
To count the number pf people is then simply a matter of counting the rows
in the people table. Join the two tables in a query for the purpose of your
analysis in Excel.
It is possible to count distinct values in a table, however, by counting the
rows returned by a subquery, e.g.
SELECT COUNT(*) AS NameCount
FROM (SELECT DISTINCT [Name]
FROM [YourTable]);
I'd recommend that Name not be used as a column name, however; it could
easily be confused with the built in Name property. Similarly don't use Date
as a column name.
Ken Sheridan
Stafford, England
Peres from Brazil said:
I have read all answer that contain the word “Count†and did not see a
solution for my problem:
I have a database with a field “Name†and other field “Date†.
Every day same one calls me, I input the Name of the caller and the Date in
the respective field.
I analyze this database using an Excel pivot table.
Now I want to know how many Names I have, but because of the repetition I
ways get the total number of records.
What I want is number of persons and not the number of names: If “Josephâ€
called me 30 times I want it count just as 1 and not 30
Thanks in advance for any help
Luiz