Use a formula in the detail section for this.
Your example would be:
whileprintingrecords;
numbervar Smiths;
If {table.last} = "SMith" then
Smiths:=Smiths+1
In the report footer you could use th following to display it:
whileprintingrecords;
numbervar Smiths
This is a bad example because there are much simpler ways to accomplish this, such as a Running Total, select the field, use a count as the type, and in the Evaluate Use a Formula just place {table.last} = "Smith"
Or you might use a Cross-Tab and place the Last Name in the Rows and in the summary section and select count to get all names in one simple action (place the cross-tab in the report header or report footer).
Ratehr than suggesting technologies, try posting example data and expected output just in case others might have something meaningful to contribute to the design.
-k