Summarize according the column A

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Summarize according the column A

Post by matthewR »

In column A, I have names. There are 3 columns I would like to add according to the names in column A. They names are scattered and not together. So say Jerry has one row with data in Current, Prev and YtD and 4 other rows with this data. I want to create a row adjacent to the data that sums all of Jerry's Current, Prev and YTD so that now I have a total Current and a total Prev and a total YTD. I hope I am making sense.

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Summarize according the column A

Post by HansV »

Could you post a small sample workbook?
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Summarize according the column A

Post by matthewR »

I am attaching a spreadsheet that I got from this site - it is a function. I think it is what I need but I don't know how to adjust it for 3 columns. I started to expand the sheet but I think the function needs adjusted. The data I have has subtotals so I think this would work.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Summarize according the column A

Post by HansV »

The Raw Data table is incomprehensible - there are a few subtotal formulas in it, but the table is not sorted, so these formulas make no sense.

Could you try to explain what your goal is?
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Summarize according the column A

Post by matthewR »

In the "raw data" area the names in the first column are scattered throughout the data. The "Totals" area takes the name "Two" for example and totals all the twos except for the "Two" total row. If you add up all the numbers for Two excluding the total row they should add up to 84 using the function - =SUbtotalIF(Labels,A2,Values). What I want to do in the "Totals" area is to add two more columns since the real data has two more columns to total. This is just example data but the real data is similar. I don't know if this can be done using this user defined function but I thought it looked like what I needed except it was totaling one column and I need 3 columns totaled for each of the names in column A under "Totals".

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Summarize according the column A

Post by HansV »

Why do cells F5, F12 and F18 contain formulas?
Best wishes,
Hans

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Summarize according the column A

Post by matthewR »

I think for this example, the raw data was subtotaled using the command "subtotals" under data. I think the user defined function was to total everything say for "Two" except the total row since when you use subtotal it uses the same name and the requestor didn't want the total row included.

User avatar
HansV
Administrator
Posts: 78629
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Summarize according the column A

Post by HansV »

The subtotal formulas in the raw data make no sense. SUBTOTAL only works correctly if the data have been sorted, and these haven't. Moreover, the formulas are only in column F, not in G and H. Besides, these are raw data, so subtotals have no place. You should remove these incorrect and incomplete subtotoals rows.

You can then use formulas like this in B2:

=SUMPRODUCT((Labels=A2)*$F$2:$H$17)
Best wishes,
Hans