Formula for summing totals based on month and department, where department can change month by month...

dshtesy

New Member
Joined
Jun 22, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Can anyone help with a formula for the below. I am wanting to get a monthly summary for the Total for each department. So, in cell B12, I would expect to see 21 as in May-23, Department A had Total costs of 15 (cell D3) and 6 (cell D4).

Most of the formulas I have tried are returning #Value!, I think because of the department values not being numbers and being included in the data.


TIA


1687414939815.png
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Welcome to the MrExcel board!

Can you confirm whether those months in rows 1 and 10 are actual dates or text values?
If dates, are they the 1st day of the month?


It would also help greatly (& get faster help) if you could provide the sample data in a form that we can copy - instead of lots of typing. :)
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 1
Monthly department wages example.xlsx
ABCDEFGHIJKLM
1MonthMay-23May-23May-23May-23Jun-23Jun-23Jun-23Jun-23Jul-23Jul-23Jul-23Jul-23
2SalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartment
3Person 151015A527D5712D
4Person 2336A347A347A
5Person 36814B6612B628B
6Person 4325C358C358C
7Person 59312D9413D9817D
8Person 68614C8311C8412C
9
10May-23Jun-23Jul-23
11Department
12A
13B
14C
15D
Sheet1
Cell Formulas
RangeFormula
D3:D8,L3:L8,H3:H8D3=B3+C3
 
Upvote 0
Welcome to the MrExcel board!

Can you confirm whether those months in rows 1 and 10 are actual dates or text values?
If dates, are they the 1st day of the month?


It would also help greatly (& get faster help) if you could provide the sample data in a form that we can copy - instead of lots of typing. :)
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Thank you very much Peter_SSs for both the welcome and the help.

I have tried to upload the sheet using the XL2BB Add-in. I think it has worked.

The months are actual dates and are dated the end of the month.
 
Upvote 0
Thanks for the XL2BB sample data. (y)
Would this be suitable?

23 06 22.xlsm
ABCDEFGHIJKLM
1MonthMay-23May-23May-23May-23Jun-23Jun-23Jun-23Jun-23Jul-23Jul-23Jul-23Jul-23
2SalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartment
3Person 151015A527D5712D
4Person 2336A347A347A
5Person 36814B6612B628B
6Person 4325C358C358C
7Person 59312D9413D9817D
8Person 68614C8311C8412C
9
10May-23Jun-23Jul-23
11Department
12A2177
13B14128
14C191920
15D122029
Monthly Totals
Cell Formulas
RangeFormula
D3:D8,L3:L8,H3:H8D3=B3+C3
B12:D15B12=LET(m,FILTER($B$3:$M$8,$B$1:$M$1=B$10),SUM(FILTER(m,INDEX(m,0,4)=$A12,0))/2)
 
Upvote 1
Solution
Thanks for the XL2BB sample data. (y)
Would this be suitable?

23 06 22.xlsm
ABCDEFGHIJKLM
1MonthMay-23May-23May-23May-23Jun-23Jun-23Jun-23Jun-23Jul-23Jul-23Jul-23Jul-23
2SalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartment
3Person 151015A527D5712D
4Person 2336A347A347A
5Person 36814B6612B628B
6Person 4325C358C358C
7Person 59312D9413D9817D
8Person 68614C8311C8412C
9
10May-23Jun-23Jul-23
11Department
12A2177
13B14128
14C191920
15D122029
Monthly Totals
Cell Formulas
RangeFormula
D3:D8,L3:L8,H3:H8D3=B3+C3
B12:D15B12=LET(m,FILTER($B$3:$M$8,$B$1:$M$1=B$10),SUM(FILTER(m,INDEX(m,0,4)=$A12,0))/2)
Brill, that has worked. Thank you very much.

Is there a formula to count how many people are in each department each month?
 
Upvote 0
Brill, that has worked. Thank you very much.
Good news! You are welcome. :)

Is there a formula to count how many people are in each department each month?
Like this?

23 06 22.xlsm
ABCDEFGHIJKLM
1MonthMay-23May-23May-23May-23Jun-23Jun-23Jun-23Jun-23Jul-23Jul-23Jul-23Jul-23
2SalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartment
3Person 151015A527D5712D
4Person 2336A347A347A
5Person 36814B6612B628B
6Person 4325C358C358C
7Person 59312D9413D9817D
8Person 68614C8311C8412C
9
10May-23Jun-23Jul-23
11Department
12A211
13B111
14C222
15D122
People Count
Cell Formulas
RangeFormula
D3:D8,L3:L8,H3:H8D3=B3+C3
B12:D15B12=COUNTIF(INDEX($B$3:$M$8,0,MATCH(B$10,$B$1:$M$1,0)+3),$A12)
 
Upvote 1
Good news! You are welcome. :)


Like this?

23 06 22.xlsm
ABCDEFGHIJKLM
1MonthMay-23May-23May-23May-23Jun-23Jun-23Jun-23Jun-23Jul-23Jul-23Jul-23Jul-23
2SalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartmentSalaryBonus/DividendTotalDepartment
3Person 151015A527D5712D
4Person 2336A347A347A
5Person 36814B6612B628B
6Person 4325C358C358C
7Person 59312D9413D9817D
8Person 68614C8311C8412C
9
10May-23Jun-23Jul-23
11Department
12A211
13B111
14C222
15D122
People Count
Cell Formulas
RangeFormula
D3:D8,L3:L8,H3:H8D3=B3+C3
B12:D15B12=COUNTIF(INDEX($B$3:$M$8,0,MATCH(B$10,$B$1:$M$1,0)+3),$A12)
Fantastic, thank you very much indeed 👍👍👍
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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