Sum amounts from various sheets

Suresh Kusunuri

Board Regular
Joined
Dec 28, 2007
Messages
138
Office Version
  1. 2007
Platform
  1. Windows
Hi All,

I have 12 sheets work book for Salaries. I wish to calculate total salary of each person during the year.

I used the following formula, but its showing "#REF".
=SUMPRODUCT(SUMIF(INDIRECT(""&Months&EMP),$C5,(INDIRECT("'"&Months&$O$5:$O$72))))
Months = List of Sheets
EMP = List of Employees
Range in RED = Salary Column (in Each Sheet)
$C5 = Employee's Name
Can any one help me in this calculation or suggest other formula

Thanks
Suresh
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Have you considered using just one sheet?
You will probably receive more replies if you post sample data with the forum's tool named XL2BB.

Edit the following for your data

try a formula like =SUMPRODUCT(SUMIF(INDIRECT("'"&Sheets&"'!"&"A2:A200"),A3,INDIRECT("'"&Sheets&"'!"&"B2:B200")))
or =SUMPRODUCT(SUMIF(INDIRECT("'"&Months&"'!"&"A5:A72"),C5,INDIRECT("'"&Months&"'!"&"O5:O72")))
 
Upvote 0
Have you considered using just one sheet?
You will probably receive more replies if you post sample data with the forum's tool named XL2BB.

Edit the following for your data

try a formula like =SUMPRODUCT(SUMIF(INDIRECT("'"&Sheets&"'!"&"A2:A200"),A3,INDIRECT("'"&Sheets&"'!"&"B2:B200")))
or =SUMPRODUCT(SUMIF(INDIRECT("'"&Months&"'!"&"A5:A72"),C5,INDIRECT("'"&Months&"'!"&"O5:O72")))
Thank you Mr. Dave for your support. The said formulas are also showing same results. May be OS or Excel Version is wrong. I am using Windows 11 and Office 16. I am enclosing my work book for your reference and guidance.

Thanks & Regards
 

Attachments

  • Sheet Name_ Apr'23.png
    Sheet Name_ Apr'23.png
    41.5 KB · Views: 5
  • Sheet Name_ Jun'23.png
    Sheet Name_ Jun'23.png
    54.2 KB · Views: 5
  • Sheet Name_ May'23.png
    Sheet Name_ May'23.png
    44.4 KB · Views: 5
  • Sheet Name_ Summary.png
    Sheet Name_ Summary.png
    38.3 KB · Views: 5
Upvote 0
You did not answer questions or post information that were can use to test a formula!
Please update your profile to show the version of Excel that you are using.
Try
=SUMPRODUCT(SUMIF(INDIRECT("'"&Months&"'!"&"C5:C75"),C5,INDIRECT("'"&Months&"'!"&"D5:D75")))

Ensure that the ranges or references for the names, amounts, and criteria are correct.
 
Upvote 0
You did not answer questions or post information that were can use to test a formula!
Please update your profile to show the version of Excel that you are using.
N.B. The monthly sheets must be actual Excel sheets not a png file.
Try naming your sheets similar to 2023_Jan

With Excel 365, try
Try
=SUM(SUMIF(INDIRECT("'"&Months&"'!"&"C5:C75"),C5,INDIRECT("'"&Months&"'!"&"D5:D75"))) or
or
=SUM(SUMIF(INDIRECT(Months&"!C5:C75"),C5,INDIRECT(Months&"!D5:D75")))

Ensure that the ranges or references for the names, amounts, and criteria are correct.
 
Upvote 0
Hi, Mr. Dave

Your formula is working but result is wrong. Plz see the following:

Salaries.xlsx
BCDEFGHIJKLMNOPQRS
2S.No.Name of the EmployeeEarningsDeductionsAdditionsNet Payable
3GrossTotal1234AdvanceTotalWelfare
4Formulawith Cell Ref (Required Result)Formula works like this
51ALEXANDER46,666.676,133.3346,666.67 =SUMPRODUCT(SUMIF(INDIRECT("'"&Month_List&"'!"&"EMP"),$C5,INDIRECT("'"&Month_List&"'!"&"$d$5:$d$22")))
62ANDREW44,783.0077,133.3344,783.00
73BUTTLER42,500.0078,166.6742,500.00
84CHERRY43,066.6743,616.3343,066.67--
95DAVID63,400.3339,500.0063,400.33--
106EDEN CLARA75,166.6745,200.3375,166.67--
117FIONA65,000.0041,500.0065,000.00--
128JOHN63,000.0035,833.3363,000.00--
139JOSEPH55,500.0015,000.0055,500.00--
1410LILY71,666.6736,250.0071,666.67--
1511MASON37,000.0038,150.0037,000.00--
1612MATHEW34,650.0033,500.0034,650.00--
1713RAYAN6,133.3325,000.006,133.33--
1814REAGAN13,000.006,133.3313,000.00--
1915SMITH41,666.6763,750.0041,666.67--
2016STELLA25,000.0041,666.6725,000.00--
2117XAVIER-13,000.00---
2218ZION-88,666.67---
23 Total 7,28,2007,28,200---------
24
Summary
Cell Formulas
RangeFormula
K3:L3K3='2022_Apr'!J4
D5:D22D5=SUMPRODUCT(SUMIF(INDIRECT("'"&Month_List&"'!"&"EMP"),$C5,INDIRECT("'"&Month_List&"'!"&"$d$5:$d$22")))
E5E5='2022_Apr'!$D$8
F5:F22F5='2022_Apr'!D5+'2022_May'!D5+'2022_Jun'!D5
E6E6='2022_Apr'!$D$9+'2022_May'!$D$8+'2022_Jun'!$D$7
E7E7='2022_Apr'!$D$12+'2022_May'!$D$11+'2022_Jun'!$D$10
E8E8='2022_Apr'!$D$6+'2022_May'!$D$6+'2022_Jun'!$D$5
E9E9='2022_Apr'!$D$7+'2022_May'!$D$7+'2022_Jun'!$D$6
E10E10='2022_Apr'!D10+'2022_May'!D9+'2022_Jun'!$D$8
E11E11='2022_Apr'!$D$11+'2022_May'!$D$10+'2022_Jun'!$D$9
E12E12='2022_Apr'!$D$5+'2022_May'!$D$5
E13E13='2022_Jun'!$D$16
E14E14='2022_May'!$D$14+'2022_Jun'!$D$13
E15E15='2022_May'!$D$16+'2022_Jun'!$D$15
E16E16='2022_May'!$D$15+'2022_Jun'!$D$14
E17E17='2022_Jun'!$D$20
E18E18='2022_Jun'!$D$17
E19E19='2022_Apr'!$D$13+'2022_May'!$D$12+'2022_Jun'!$D$11
E20E20='2022_Jun'!$D$19
E21E21='2022_Jun'!$D$18
E22E22='2022_Apr'!$D$14+'2022_May'!$D$13+'2022_Jun'!$D$12
M8:M22M8=SUM(H8:L8)
O8:O22O8=G8-M8+N8
G23:O23,D23:E23D23=SUM(D5:D22)
Named Ranges
NameRefers ToCells
Month_List=Summary!$AE$5:$AE$7D5:D22



It is adding row wise amounts from each sheet, not considering the name (Cell reference "C5" like that, in sumif function).

Kindly do the needful to get the correct result.

Thanks & Regards,

Suresh
 
Upvote 0
I do not see the formula that I suggested.
You did not post an example of the data sheets.

try
=SUMPRODUCT(SUMIF(INDIRECT("'"&Month_List&"'!"&"C5:C75"),C5,INDIRECT("'"&Month_List&"'!"&"D5:D75")))

Ensure that the ranges and references for the names, amounts, and criteria are correct.

Test with reference to known information and edit the formula if necessary.

Make a post with a concise version of your data and indicate the result that you expect.
 
Upvote 0
In your monthly sheets, what column or range has the employee name?
If the names are in Column B and the required numbers are in Column D, edit the suggested formula to

=SUMPRODUCT(SUMIF(INDIRECT("'"&Month_List&"'!"&"B5:B75"),C5,INDIRECT("'"&Month_List&"'!"&"D5:D75")))

Please edit the formula for the relevant ranges and test.
 
Upvote 0
3D Sumif 365.xlsm
ABCDQ
1
2S.No.Name of the EmployeeEarningsMonth_List
3Gross2022_Apr
4Formula2022_May
51ALEXANDER100
62ANDREW300
73BUTTLER400
84CHERRY500
95DAVID600
Summary
Cell Formulas
RangeFormula
D5:D9D5=SUMPRODUCT(SUMIF(INDIRECT(Month_List&"!C5:C100"),C5,INDIRECT(Month_List&"!D5:D100")))
Named Ranges
NameRefers ToCells
Month_List=Summary!$Q$3:$Q$4D5:D9
 
Upvote 0
3D Sumif 365.xlsm
ABCDQ
1
2S.No.Name of the EmployeeEarningsMonth_List
3Gross2022_Apr
4Formula2022_May
51ALEXANDER100
62ANDREW300
73BUTTLER400
84CHERRY500
95DAVID600
Summary
Cell Formulas
RangeFormula
D5:D9D5=SUMPRODUCT(SUMIF(INDIRECT(Month_List&"!C5:C100"),C5,INDIRECT(Month_List&"!D5:D100")))
Named Ranges
NameRefers ToCells
Month_List=Summary!$Q$3:$Q$4D5:D9
Thank you Mr. Dave, its working perfectly. Only thing is the source data should be same size in each month (No of employees).
To get result, I am inserting blank rows to reach the size of Data.
Thank you once again for your support.

Suresh
 
Upvote 0

Forum statistics

Threads
1,215,140
Messages
6,123,269
Members
449,093
Latest member
Vincent Khandagale

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