**Need SumIf with Variable Sum Range**

vanray

New Member
Joined
Mar 16, 2011
Messages
6
I need to take the dollar amounts from Sheet 1 and get them into the format in Sheet 2. I already have the first two columns in Sheet 2 populated with the department and account, so I just need to use some lookup function to grab the dollar amounts. I've created a unique identifier in Sheet1 Column C by concatenating the month and account.

I'll be writing the formula in Sheet 2!C2. In English, I want the formula to say:

sumif(Sheet1!C:C,"JanTaxes","only in column D")

I have used nested vlookups before where I referenced a table that I had created associating a department with a column number, but in this case it would only return the first occurence. I can use the sumif to return all occurences, but can't use a variable sum column.

Any insight would be GREATLY appreciated.

Thank you!


Sheet1:
--A------------B-----------C------------D--------E-----------F
Month____Account___Concat_____Finance___IT_____Marketing
Jan--------Taxes-------JanTaxes-------$10-------$0---------$0
Jan--------Rent--------JanRent--------$25--------$0---------$0
Jan--------Software----JanSoftware----$0--------$50--------$0
Jan--------Taxes-------JanTaxes-------$75-------$0---------$0

Sheet2:

-A-----------B----------C---------D----------E
Dept____Account____Jan_____Feb______Mar
Finance---Taxes-------$85
Finance---Taxes-------$25
Finance---Software----$0
IT--------Rent--------$0
IT--------Taxes-------$0
IT--------Software----$50
Marketing-Rent--------$0
Marketing-Taxes-------$0
Marketing-Software----$0
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
=SUMIF(Sheet1!$C:$C,C$1&$B2,INDEX(Sheet1!$1:$1,1,MATCH($A2,Sheet1!$1:$1)))

Adjust to fit your ranges.
 
Upvote 0
Thank you for the quick reply. I'm almost there, but I don't quite understand the "Sheet1!$1:$1" parts. Could you please describe what is happening in the index and match functions? Also, does "Sheet1!$1:$1" reference the first column of the sheet or are the 1s just place holders? Thank you for your help. I greatly appreciate it.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,730
Members
452,939
Latest member
WCrawford

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