Sum from different sheets

cflorackis

Board Regular
Joined
Aug 18, 2002
Messages
137
Dear all,

I am trying to do a summation using information from different sheets.

I essentially have information on the names and compensation of the employees of company A----data for different years come in different sheets-----e.g. here is an example of how my data are structured for year 2007
sample.xls
ABCD
1Company A: Year 2007
2NameRolesalarybonus
3georgeFD107
4JohnCEO158
5ED Total239
6ED Average475
7jimIndependent NED78
8StevenIndependent NED34
2007


and here for year 2006:
sample.xls
ABCD
1Company A: Year 2006
2NameRolesalarybonus
3georgeFD830
4JohnCEO520
5ED Total212
6ED Average47
7jimIndependent NED34
8BillIndependent NED611
2006



What I need to do is to find a way to calculate the sum of salary and bonus for company A for each year separately and then have it in a different sheet or file e.g. according to the information provided above the sum of salary for year 2006 is 22 (8+5+3+6)----please note that the numbers in cells A5 and A6 have to be ignored since they do not correspond to any individuals.

Similarly, for year 2007, the sum of salary is 35 (10+15+7+3)

Here is an example of how i would like to have my data organized
Book1
ABCDE
1CompanyYearsum of salarysum of bonusnumber of indiviuals paid
2companyA200735274
3companyA200622654
Sheet1

(Column E just reports the number of individuals paid in each year)

many thanks in advance

This has been causing problems to me for a long time so any help will be greatly appreciated

C.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
is this what you want ?

Look for the formula in the third table:
Book1
ABCDEFGHIJK
1CompanyA2007CompanyA2006
2NameRoleSalaryBonusNameRoleSalaryBonus
3GeorgeFD107GeorgeFD830
4JohnCEO158JohnCEO520
5239212
647547
7JimIndependent78JimIndependent34
8StevenIndependent34StevenIndependent611
9
10
11Companyyearsumsalarysumbonusnumberofindividualspaid
12CompanyA200735274
13CompanyA200622654
14
Sheet1
 
Upvote 0
In cell D12 - the formula will be:
=SUMPRODUCT(--(A3:A8<>""),(C3:C8))

In cell D13 - the formula will be:
=SUMPRODUCT(--(G3:G8<>""),(I3:I8))

In cell E12 - the formula will be:
=SUMPRODUCT(--(A3:A8<>""),(D3:D8))

In cell E13 - the formula will be:
=SUMPRODUCT(--(G3:G8<>""),(J3:J8))

In cell F12 - the formula will be:
=SUMPRODUCT(--(A3:A8<>""))

In cell F13 - the formula will be:
=SUMPRODUCT(--(G3:G8<>""))
 
Upvote 0
Many thanks to both of you

Stormseed’s solution, though, does not help much since it requires to copy and paste all my data to the same sheet, which is a very difficult thing to do for the case of my sample.

Regarding Aladin’s suggestion: Aladin, may ask for some clarifications :

1) I tried it but its seems that the formula does not take into account the blank cells---e.g. remember that when there is a blank cell in column A, the corresponding salary values have to be ignored

2) I am using the formula to get the sum of salary (column C) . Is there a way to use the Autofill option to get the sum of bonus (column D)---I tried to drag on the right but it does not work

Many thanks again for your valuable help

C.
 
Upvote 0
Stormseed’s solution, though, does not help much since it requires to copy and paste all my data to the same sheet, which is a very difficult thing to do for the case of my sample

Dude, try and think out of the box. You should apply the same logic at your end on different sheets. I thought what you needed is the idea to calculate the sum of salary and bonus for individuals who had a name in column A. I did not post a screenshot of the above example on different sheets because I was short of time.

you are welcome.
 
Upvote 0
Many thanks to both of you

Stormseed’s solution, though, does not help much since it requires to copy and paste all my data to the same sheet, which is a very difficult thing to do for the case of my sample.

Regarding Aladin’s suggestion: Aladin, may ask for some clarifications :

1) I tried it but its seems that the formula does not take into account the blank cells---e.g. remember that when there is a blank cell in column A, the corresponding salary values have to be ignored

2) I am using the formula to get the sum of salary (column C) . Is there a way to use the Autofill option to get the sum of bonus (column D)---I tried to drag on the right but it does not work

Many thanks again for your valuable help

C.

The formula won't sum numbers associated with empty cells. It does, however, sum all the years together. That is, it does not sum by companies.

May I ask whether the sheet named 2006 contain different companies?
 
Upvote 0
Aladin,

the sheet named 2006 refers to the same company as the sheet named 2007. The two sheets may contain different individuals

cheers

C.
 
Upvote 0
Sheet1...

C2, coy down:

=SUMIF(INDIRECT("'"&$B2&"'!A3:A8"),"<>",INDIRECT("'"&$B2&"'!C3:C8"))

D2, copy down:

=SUMIF(INDIRECT("'"&$B2&"'!A3:A8"),"<>",INDIRECT("'"&$B2&"'!D3:D8"))

E2, copy down:

=COUNTIF(INDIRECT("'"&$B2&"'!A3:A8"),"?*")

P.S. You can avoid calling INDIRECT if you calculate the results locally on the data sheets and collect the results on Sheet1.

Aladin,

the sheet named 2006 refers to the same company as the sheet named 2007. The two sheets may contain different individuals

cheers

C.
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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