Sum colunms base on same header

xtwo

New Member
Joined
Apr 19, 2011
Messages
1
Hello all,

I am new here, and also new to excel. I have the data as below, and I tried to sum up the columns which have the same header together and others separately. I played with sumif function for while and googled it but no help, I am not sure why the below formula could not sum up the highlight ones.

=SUM(IF(C1=D1,C2:D10517,0))

unledz.jpg


I'm really appreciated with any of your inputs.

Regards,
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If I am understanding your correctly you will need something more like this:

=IF(C1=D1,SUM(C2:D10517),0)
 
Upvote 0
I'll give you a formula that should work, and try to explain why it works:

In cell C10518 =sumproduct(($C$1:$Z$1=C1)*($D$1:$Z$10517))
copy that to the rest of your columns.

First I assumed your columns went out to Z, you can change this appropriately.

The $C$1:$Z$1=C1 looks at your header and sees which ones match the header of the row you are in. If it is true, Excel says the answer is 1. If it is false, Excel says the answer is 0. It then multiplies all the 1s and 0s from your header piece times each piece of data below it and add the products all up.

If you are real beginner, the $'s make it so that range does not change when you copy it to adjacent cells.

The explaination may be a little weak, but I hope this puts you in the right path.

Jeff
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,814
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top