Sum Multiple Columns in Table based string in Table Headers

bbjok

New Member
Joined
Apr 12, 2016
Messages
3
Need serious help.
I have a spreadsheet with multiple columns in a table with the same 3 digit ending.
Table Header names: Name, ID, JAN-FFF, JAN-HHH, FEB-FFF, FEB-HHH, MAR-FFF, MAR-HHH, and so on until DEC-HHH

The -FFF and -HHH Columns are all numbers but represent different aspects.
Using a Formula in cell I1.
Given the table with data is named tblNAMEDRANGE is a Named Range "NAMEDRANGE"
I want to sum all columns that end with header ending -FFF and have "John" in the Name Column and "555" in the ID Column.
I want to sum all columns that end with header ending -HHH and have "John" in the Name Column and "555" in the ID Column.
I want to sum all columns that end with header ending -FFF and have "Mike" in the Name Column and "811" in the ID Column.

ABCDEFGHI
1NameIDJAN-FFFJAN-HHHFEB-FFFFEB-HHHMAR-FFFMAR-HHH
2John5550.5800.51600.5200
3Zack5550.8400.7900.312
4John9000.1440.9220.194
5John5550.1330.75331.088
6Mike8110.3550.9880.311
7April6000.4330.4220.188
8Mike8110.2880.9330.233
9

<tbody>
</tbody>
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi,

=SUMPRODUCT( (RIGHT(C1:H1,4)="-FFF")*(A2:A8="John")*(B2:B8=555)*(C2:H8) )
=SUMPRODUCT( (RIGHT(C1:H1,4)="-HHH")*(A2:A8="John")*(B2:B8=555)*(C2:H8) )
=SUMPRODUCT( (RIGHT(C1:H1,4)="-FFF")*(A2:A8="Mike")*(B2:B8=811)*(C2:H8) )

Regards
XLearner
 
Upvote 0
246
NameIDJAN-FFFJAN-HHHFEB-FFFFEB-HHHMAR-FFFMAR-HHH1NameIDJAN-FFFFEB-FFFMAR-FFF
John5550.5800.51600.52002John5550.50.50.5
Zack5550.8400.7900.3123Zack5550.80.70.3
John9000.1440.9220.1944John9000.10.90.1
John5550.1330.75331885John5550.10.751
Mike8110.3550.9880.3116Mike8110.30.90.3
April6000.4330.4220.1887April6000.40.40.1
Mike8110.2880.9330.2338Mike8110.20.90.2
I want to sum all columns that end with header ending -FFF and have "John" in the Name Column and "555" in the ID Column.
I want to sum all columns that end with header ending -HHH and have "John" in the Name Column and "555" in the ID Column.
I want to sum all columns that end with header ending -FFF and have "Mike" in the Name Column and "811" in the ID Column.
NameJohn
ID555
by using offset function you can automatically split the the table into FFF and HHH
JAN-FFFFEB-FFFMAR-FFFDataTotal
then it is cery easy and staightforward to use sumproduct to sum by John and 5550.10.751Sum of JAN-FFF0.1
Sum of FEB-FFF0.75
Sum of MAR-FFF1
0.75 Sum of JAN-FFF0.1
John 0.75 Sum of FEB-FFF0.75
555 0.75 Sum of MAR-FFF1
0.1 Sum of JAN-FFF 0.1
0.1 Sum of FEB-FFF 0.75
0.60.1 Sum of MAR-FFF 1
0.50.50.5Sum of JAN-FFF0.5
=SUMPRODUCT(($K$3:$K$9=C26)*($L$3:$L$9=C27)*($M$3:$M$9)) Sum of FEB-FFF0.5
Sum of MAR-FFF0.5
0.5 Sum of JAN-FFF 0.5
this just for Jan but add elements with n3:n9 etc 0.5 Sum of FEB-FFF 0.5
0.5 Sum of MAR-FFF0.5
or a pivot table0.5 Sum of JAN-FFF 0.5
(can be tidied up)0.5 Sum of FEB-FFF 0.5
0.5 Sum of MAR-FFF 0.5
bottom 3 rows are the totalsTotal Sum of JAN-FFF 0.6
Total Sum of FEB-FFF 1.25
Total Sum of MAR-FFF 1.5

<colgroup><col span="13"><col><col><col span="2"></colgroup><tbody>
</tbody>
 
Upvote 0
Hi,

=SUMPRODUCT( (RIGHT(C1:H1,4)="-FFF")*(A2:A8="John")*(B2:B8=555)*(C2:H8) )
=SUMPRODUCT( (RIGHT(C1:H1,4)="-HHH")*(A2:A8="John")*(B2:B8=555)*(C2:H8) )
=SUMPRODUCT( (RIGHT(C1:H1,4)="-FFF")*(A2:A8="Mike")*(B2:B8=811)*(C2:H8) )

Regards
XLearner

PERFECT!!!!! :cool:

Thank you very very much that works.

My new query is =SUMPRODUCT((RIGHT(tblNAMEDRANGE[[#Headers],[Feb-FFF]:[DEC-HHH]],4)="-FFF")*(tblNAMEDRANGE[ID]=$I$2)*(ValuesNAMEDRANGE))
ValuesNAMEDRANGE is C1:H1
$I$2 is the ID which is actually a Data Validation List of "ID" field to use as a filter criteria for the query.
I will also change ..."-FFF"... to a reference to a Data Validation List of filter criteria.

I have follow-on questions:
1. Can or can't I use ...RIGHT(A1:H1,4)...
2.
Can or can't I just use ...RIGHT(tblNAMEDRANGE[#Headers],4)...
2a. I actually implemented it like this and it works: ...RIGHT(tblNAMEDRANGE[#Headers],[JAN-FFF]:[DEC-HHH]],4)...
 
Upvote 0

Forum statistics

Threads
1,216,117
Messages
6,128,935
Members
449,480
Latest member
yesitisasport

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