Smarter Way to Sum from Multiple Tables

dwgnome

Active Member
Joined
Dec 18, 2005
Messages
441
I am looking for a better way to sum values from multiple tables located on a different worksheet.I am using a series of IF statements but soon will run into the nested IF limitation as I need to expand the summary table to include many more tables located on the other worksheet called Engine Evaluation.


Currently the formulas in D17 and E17 etc work.See summary table below

Evaluation Summary

padding-right:2pt; "> " />
*CDE
16EngineEngines Tested (annual)Fuel Usage (annual)
17PW409012,800
18PW407712,800
19PW406012,800
20PW200012,800
21CFM563C25,600
22PW300000
23Other**
24Total616,800

<colgroup><col style="width: 105px;"><col style="width: 80px;"><col style="width: 87px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
D17=IF(C17='Engine Evaluation'!C$15,'Engine Evaluation'!G$16)+IF(C17='Engine Evaluation'!H$15,'Engine Evaluation'!L$16)+IF(C17='Engine Evaluation'!C$30,'Engine Evaluation'!G$31)+IF(C17='Engine Evaluation'!H$30,'Engine Evaluation'!L$31)+IF(C17='Engine Evaluation'!C$45,'Engine Evaluation'!G$46)+IF(C17='Engine Evaluation'!H$45,'Engine Evaluation'!L$46)
E17=IF(C17='Engine Evaluation'!C$15,'Engine Evaluation'!G$18)+IF(C17='Engine Evaluation'!H$15,'Engine Evaluation'!L$18)+IF(C17='Engine Evaluation'!C$30,'Engine Evaluation'!G$33)+IF(C17='Engine Evaluation'!H$30,'Engine Evaluation'!L$33)+IF(C17='Engine Evaluation'!C$45,'Engine Evaluation'!G$48)+IF(C17='Engine Evaluation'!H$45,'Engine Evaluation'!L$48)
D18=IF(C18='Engine Evaluation'!C$15,'Engine Evaluation'!G$16)+IF(C18='Engine Evaluation'!H$15,'Engine Evaluation'!L$16)+IF(C18='Engine Evaluation'!C$30,'Engine Evaluation'!G$31)+IF(C18='Engine Evaluation'!H$30,'Engine Evaluation'!L$31)+IF(C18='Engine Evaluation'!C$45,'Engine Evaluation'!G$46)+IF(C18='Engine Evaluation'!H$45,'Engine Evaluation'!L$46)
E18=IF(C18='Engine Evaluation'!C$15,'Engine Evaluation'!G$18)+IF(C18='Engine Evaluation'!H$15,'Engine Evaluation'!L$18)+IF(C18='Engine Evaluation'!C$30,'Engine Evaluation'!G$33)+IF(C18='Engine Evaluation'!H$30,'Engine Evaluation'!L$33)+IF(C18='Engine Evaluation'!C$45,'Engine Evaluation'!G$48)+IF(C18='Engine Evaluation'!H$45,'Engine Evaluation'!L$48)
D19=IF(C19='Engine Evaluation'!C$15,'Engine Evaluation'!G$16)+IF(C19='Engine Evaluation'!H$15,'Engine Evaluation'!L$16)+IF(C19='Engine Evaluation'!C$30,'Engine Evaluation'!G$31)+IF(C19='Engine Evaluation'!H$30,'Engine Evaluation'!L$31)+IF(C19='Engine Evaluation'!C$45,'Engine Evaluation'!G$46)+IF(C19='Engine Evaluation'!H$45,'Engine Evaluation'!L$46)
E19=IF(C19='Engine Evaluation'!C$15,'Engine Evaluation'!G$18)+IF(C19='Engine Evaluation'!H$15,'Engine Evaluation'!L$18)+IF(C19='Engine Evaluation'!C$30,'Engine Evaluation'!G$33)+IF(C19='Engine Evaluation'!H$30,'Engine Evaluation'!L$33)+IF(C19='Engine Evaluation'!C$45,'Engine Evaluation'!G$48)+IF(C19='Engine Evaluation'!H$45,'Engine Evaluation'!L$48)
D20=IF(C20='Engine Evaluation'!C$15,'Engine Evaluation'!G$16)+IF(C20='Engine Evaluation'!H$15,'Engine Evaluation'!L$16)+IF(C20='Engine Evaluation'!C$30,'Engine Evaluation'!G$31)+IF(C20='Engine Evaluation'!H$30,'Engine Evaluation'!L$31)+IF(C20='Engine Evaluation'!C$45,'Engine Evaluation'!G$46)+IF(C20='Engine Evaluation'!H$45,'Engine Evaluation'!L$46)
E20=IF(C20='Engine Evaluation'!C$15,'Engine Evaluation'!G$18)+IF(C20='Engine Evaluation'!H$15,'Engine Evaluation'!L$18)+IF(C20='Engine Evaluation'!C$30,'Engine Evaluation'!G$33)+IF(C20='Engine Evaluation'!H$30,'Engine Evaluation'!L$33)+IF(C20='Engine Evaluation'!C$45,'Engine Evaluation'!G$48)+IF(C20='Engine Evaluation'!H$45,'Engine Evaluation'!L$48)
D21=IF(C21='Engine Evaluation'!C$15,'Engine Evaluation'!G$16)+IF(C21='Engine Evaluation'!H$15,'Engine Evaluation'!L$16)+IF(C21='Engine Evaluation'!C$30,'Engine Evaluation'!G$31)+IF(C21='Engine Evaluation'!H$30,'Engine Evaluation'!L$31)+IF(C21='Engine Evaluation'!C$45,'Engine Evaluation'!G$46)+IF(C21='Engine Evaluation'!H$45,'Engine Evaluation'!L$46)
E21=IF(C21='Engine Evaluation'!C$15,'Engine Evaluation'!G$18)+IF(C21='Engine Evaluation'!H$15,'Engine Evaluation'!L$18)+IF(C21='Engine Evaluation'!C$30,'Engine Evaluation'!G$33)+IF(C21='Engine Evaluation'!H$30,'Engine Evaluation'!L$33)+IF(C21='Engine Evaluation'!C$45,'Engine Evaluation'!G$48)+IF(C21='Engine Evaluation'!H$45,'Engine Evaluation'!L$48)
D22=IF(C22='Engine Evaluation'!C$15,'Engine Evaluation'!G$16)+IF(C22='Engine Evaluation'!H$15,'Engine Evaluation'!L$16)+IF(C22='Engine Evaluation'!C$30,'Engine Evaluation'!G$31)+IF(C22='Engine Evaluation'!H$30,'Engine Evaluation'!L$31)+IF(C22='Engine Evaluation'!C$45,'Engine Evaluation'!G$46)+IF(C22='Engine Evaluation'!H$45,'Engine Evaluation'!L$46)
E22=IF(C22='Engine Evaluation'!C$15,'Engine Evaluation'!G$18)+IF(C22='Engine Evaluation'!H$15,'Engine Evaluation'!L$18)+IF(C22='Engine Evaluation'!C$30,'Engine Evaluation'!G$33)+IF(C22='Engine Evaluation'!H$30,'Engine Evaluation'!L$33)+IF(C22='Engine Evaluation'!C$45,'Engine Evaluation'!G$48)+IF(C22='Engine Evaluation'!H$45,'Engine Evaluation'!L$48)
D24=SUM(D17:D23)
E24=SUM(E17:E23)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


Below is an example of one table that covers two engines.On the actual worksheet there are several more of these tables below and another series to the right and going downwards.

Engine Evaluation

padding-right:2pt; "> " />
*BCDEFGHIJKL
14*ENGINE MODEL*********
15*PW4090***# TestedPW4077***# Tested
16*IdleApproachClimboutTakeoff1IdleApproachClimboutTakeoff1
17*Fuel Usage @ Power Setting (gal)***Total (gals)Fuel Usage @ Power Setting (gal)***Total (gals)
18*7007007007002,8007007007007002,800
19*Fuel Usage @ Power Setting (lb)****Fuel Usage @ Power Setting (lb)****
20*4,9624,9624,9624,962*4,9624,9624,9624,962*
21PollutantEmissions @ Power Setting (lb)***Total (tons)Emissions @ Power Setting (lb)***Total (tons)
22CO1022110.051002000.05
23VOC110000.01151000.01
24NOX21652123030.3021561611970.22
25SO222220.0022220.00
26PM88880.0288880.02

<colgroup><col style="width: 107px;"><col style="width: 72px;"><col style="width: 73px;"><col style="width: 76px;"><col style="width: 79px;"><col style="width: 89px;"><col style="width: 85px;"><col style="width: 80px;"><col style="width: 84px;"><col style="width: 72px;"><col style="width: 91px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4


Looking for a better way to capture and sum – perhaps using MATCH, LOOKUP or other functions or arrays.I cannot change the table layouts.Using Excel 2003.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Cell D17:
=INDEX('Engine Evaluation'!$A$15:$DD$26,1+1,MATCH($C17,'Engine Evaluation'!$A$15:$DD$15,0)+4)

Cell E17:
=INDEX('Engine Evaluation'!$A$15:$DD$26,1+3,MATCH($C17,'Engine Evaluation'!$A$15:$DD$15,0)+4)


I set the width of the array as column DD. You can adjust accordingly. The "+" statements are my lazy OFFSETs from the relative location of the Engine name.
 
Upvote 0
Thank you Vindaloo, I think you are on the right path in using the INDEX/MATCH array, however it does not capture the information in the tables below the one I showed starting at C30, C45, and Q15, V15. Your formulas only captured the first set. Total range would be C15 through Z15 and down to C56 and Z56 accordingly.
 
Upvote 0
I can't see the others, so here is what I think it would be

=INDEX('Engine Evaluation'!$A$15:$DD$1000,1+1,MATCH($C17,'Engine Evaluation'!$A$15:$DD$15,0)+4)

The first "+1" means 1 row down from where you found the engine name. The "+4" is the number of colums to the right of where you found the engine name. If you still have problems, post another table and I will show you this weekend. I can break down the INDEX & MATCH function if you need me to when the server isn't so slow.
 
Upvote 0
That formula does not work as it only picks off the first occurrence. The 1+1 basically is 2 which means two rows down from A15 (the "offset"), the MATCH part looks for PW4090 in row 15, finds it 3 cells to the right of A15 and adds 4 more to get to the correct column. However it does not go any further to the other tables. I tried changing the range to A15:DD1000, but that did not work either. I do not have any data past column Z, so don't need DD.


Thanks.
 
Upvote 0
Can you post the tables so I can see them? I can't post code till later tonight. The 1+1 is the second row in the array. I guess I could have just plugged in a 2. The value 2 equates to row 2 in the array which is Row 16. The MATCH statement identifies the column in A15:Z15 that contains the engine name referenced by the first element of the MATCH statement. In other words, the Match finds C17 and tells you how many columns to the right the engine name shows up in the array A15:Z15. The statement in English is, Find the Engine name on Row 15, then find the point of intersection 1 row below the name and the 4th column to the right where the engine name = column 1, and return the value. The index is the entire range of the Coordinates (nth row, nth column) I can look at the tables tonight if you haven't figured it out.
 
Upvote 0
This time your tables are stacked vertically, so I matched by row. If there were headers on both axis, we would use 2 match statements.

TypeEngines Fuel
PW409015,600
PW4077#N/A0
PW406012,800
PW2000#N/A2,800
CFM563C15,600
PW3000#N/A0
Other
Total#N/A16,800
<colgroup><col width="108" style="width: 81pt; mso-width-source: userset; mso-width-alt: 3840;"> <col width="82" style="width: 62pt; mso-width-source: userset; mso-width-alt: 2929;"> <col width="90" style="width: 67pt; mso-width-source: userset; mso-width-alt: 3185;"> <tbody> </tbody>

=INDEX('Engine Evaluation'!$C$15:$DD$1000,MATCH($C17,'Engine Evaluation'!$C$15:$C$1000,0)+1,5)

Although most problems can be solved with code, it doesn't hurt to get the person sending you raw data to be consistent. I still don't think I understand where your data is.
 
Upvote 0
Were you able to see the actual file with the different tabbed worksheets? The data is on a different worksheet called Engine Evaluation. If you zoom out you can see the layout.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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