Hi,
If you have more data or want an approach that will work regardless of the entries in column A, a database type approach might be of interest. Such as with a query table or pivot table: basically using SQL to do the work. Or even via VBA a query table, pivot table or ADO+recordset or similar. (If using a pivot table, the SQL could be simpler and just feed in the max values and let the pivot table do the summation.)
Assuming the data is on worksheet
Sheet1 and has headers
type and
value in row 1 with data under, the SQL for a query table could be
Code:
SELECT Sum(MyMax) AS [MyTotal]
FROM
(SELECT type, Max(value) AS [MyMax]
FROM [Sheet1$]
GROUP BY type)
To create a query table, save the file and then start via menu path data, import external data, new database query. Excel files, OK. Your Excel file & OK to any message about no visible ranges. Hit 'options' and 'system tables' to be able to see worksheet names. Or if you have used a non-dynamic named range for the source data you won't need that step. Pick the fields so that they appear in the little box on the RHS and continue until you get the option to edit in MS Query. Then hit the SQL button and replace the text you see by the text above. OK to enter that, & OK to any warning message if you get one. Then hit the 'open door' icon to return the data to an Excel worksheet. This is now a refreshable query table: it refreshes like a pivot table. This should be great even on tens or hundreds of thousands of data rows with data in closed or open Excel or database files.
I didn't test, but I'm pretty sure you can work without headers in your source data, the SQL would be slightly different. Untested,
Code:
SELECT Sum(MyMax) AS [MyTotal]
FROM
(SELECT F1, Sum(F2) AS [MyMax]
FROM [Sheet1$]
GROUP BY F1)
where I've assumed column A [called field F1] has the identifiers and column B [F2] the values.
HTH, Fazza