View Full Version : Sum Range Module for each value


Pete666
01-14-2008, 03:06 AM
I have a spreadsheet which contains a list similar to below where I need to find the unique values, and their total in the next column and paste them in another worksheet as per the Output below.

Data
COM 150
COM 150
SPF 100
SPF 100
COM 50

Output
COM 350
SPF 200

These lists may vary in size and order so I need to cover the general area. A message box needs to then appear with each unique value and their total.


Thanks

DanG
01-15-2008, 06:58 AM
Try =sumif() (look it up in excel help for a complete understanding of it).

Pete666
01-23-2008, 07:19 AM
Unfortunately not that simple.

I'm trying to build this into a module with a loop so I do not need to know the grouped values the module will run through the file, find them all and sum their respective values.

Brianwarnock
01-23-2008, 07:45 AM
Obviously you are going to start with a sort of the data , then just loop through summing till each change of data or EOF(presumably a blank cell).
You can out put a msgbox on each change or better store the result for later examination, printing etc.

Brian

Brianwarnock
01-23-2008, 07:51 AM
A simple way to get the figures without any programming is to sort then use subtotals (click data then subtotals)

Brian