Thank you for the link to SUMPRODUCT. I will study the information. Here is an example of the array formula that I am using in VBA, and it does work for me. In this example the first blank row was determined to be row #5039.
Code:
{=SUM(IF($B2:$B5038=$B5039,IF($Y2:$Y5038="A",1,0),0))}
What I have done is capture a list of unique names in column B into an array. Column B is not the primary sort and names in column B are scattered throughout the list. Then at the first blank row at the end at column B I fill in each name, let's say "Jones". The formula looks for "Jones" in columns B, cells 2-5038, and if found, does a check in column Y, cells 2-5038 for the letter "A". If both conditions are met, the value of 1 is summed otherwise the value is 0. This type of counting and summing is done for some of the other columns, then the row is copied as values into a temporary worksheet, and the loop continues until all names in the array have been used to calculate totals for each name.
I entered the array formulas only one time and only change the value in B5039, filling in the name from the array, to get the summary totals. Row 5039 gets cleared after totals are calculated for every name.
The name and new totals in the temp worksheet are sorted and copied to an area below the report worksheet.
This array formula process allows me to add sums and counts by values in certain columns, and in some cases pairs of columns (as in the above example) at the bottom of a list.
Jerry