SUM with vertical and Horizontal criteria

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,538
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I am using below formula with 3 criteria which works perfect, now I want to add 3 more criteria which are in column

I want to add Manager Name (Column B), Name of the Position (Column C) and Working at profile (Column E) along with the criteria in formula below

Book1
ABCDEFGHIJKLMNO
110/19/202110/19/202110/19/202110/19/202110/20/202110/20/202110/20/202110/20/2021
2Prority ManagerName of The PositionStatusWorking At ProfilePackageOpeningsInterviewedOfferedJoinedOpeningsInterviewedOfferedJoined
3
42Name1Associate/Sr. AssociateLiveName11820018100
52Name2Associate/Sr. AssociateLiveName21400014100
61Name3Semi Qualified CALiveName36700067000
72Name4Finance & Account ManagerClosedName410001000
81Name5Semi Qualified CALiveName57500075000
92Name6Team Leader (UK)LiveName610001000
102Name7Associate/Sr. Associate(UK)LiveName730003000
111Name8Manager (UK)LiveName8
121Name9Associate (Baroda)LiveName93800038100
131Name10CA Inter(Baroda)ClosedName1010001000
141Name11CALiveName111300013000
151Name12CALiveName121400014000
162Name13TraineeLiveName13150000150500
171Name14TraineeLiveName140005010
18Total395200400810
19
Sheet1



Book1
ABCDEFGHIJKLMNO
1OctoberOctoberOctoberOctoberNovemberNovemberNovemberNovember
2Prority ManagerName of The PositionStatusWorking At ProfilePackageOpeningsInterviewedOfferedJoinedOpeningsInterviewedOfferedJoined
3
42Name1Associate/Sr. AssociateLiveName1363000000
52Name2Associate/Sr. AssociateLiveName2281000000
61Name3Semi Qualified CALiveName31340000000
72Name4Finance & Account ManagerClosedName420000000
81Name5Semi Qualified CALiveName51500000000
92Name6Team Leader (UK)LiveName620000000
102Name7Associate/Sr. Associate(UK)LiveName760000000
111Name8Manager (UK)LiveName800000000
121Name9Associate (Baroda)LiveName9761000000
131Name10CA Inter(Baroda)ClosedName1020000000
141Name11CALiveName11260000000
151Name12CALiveName12280000000
162Name13TraineeLiveName133005000000
171Name14TraineeLiveName14
18Total395200400810
19
Sheet2
Cell Formulas
RangeFormula
G4:N16G4=SUMIFS(Sheet1!$G4:$N4,Sheet1!$G$1:$N$1,">="&DATEVALUE("1"&G$1),Sheet1!$G$1:$N$1,"<="&EOMONTH(DATEVALUE("1"&G$1),0),Sheet1!$G$2:$N$2,G$2)
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Is it mine, coming from other thread? :)
Do you mean, name repeats (duplicate) with different pos and different Profile, now sum it up base on name, pos and profile down the columns and month accross?
BTW, I could not see any duplicate data.
Try to repost new sample.
 
Upvote 0
Is it mine, coming from other thread? :)

Yes, it's yours.

Do you mean, name repeats (duplicate) with different pos and different Profile, now sum it up base on name, pos and profile down the columns and month accross?

Yes that is correct.

BTW, I could not see any duplicate data.
Try to repost new sample.

In sample there is not duplicate data, but in real there will be

Do you need new sample?
 
Upvote 0
file copy of my solution is at Box for your review

If you combine row 1 and row 2 of your source data, ie. 10/19/21 Openings, etc. Then bring the data to Power Query.
Power Query Mcode below and loaded to Data Model at the end.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Filtered Rows" = Table.SelectRows(Source, each ([#"Prority "] <> null)),
    #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"10/19/21Interviewed", "10/19/21 Interviewed"}, {"10/19/21Offered", "10/19/21 Offered"}, {"10/19/21Joined", "10/19/21 Joined"}, {"10/20/21Interviewed", "10/20/21 Interviewed"}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Renamed Columns", {"Prority ", "Manager", "Name of The Position", "Status", "Working At Profile", "Package"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", type date}}),
    #"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"Attribute.1", each Date.MonthName(_), type text}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Extracted Month Name",{{"Value", Int64.Type}})
in
    #"Changed Type1"

Once in the Data Model (Power Pivot), you can then pivot the data as below.

Book6
BCDEFGHIJK
3Sum of ValueAttribute.1Attribute.2
4October
5ProrityManagerName of The PositionStatusWorking At ProfilePackageInterviewedJoinedOfferedOpenings
61Name10CA Inter(Baroda)ClosedName10(blank)0002
7Name11CALiveName11(blank)00026
8Name12CALiveName12(blank)00028
9Name14TraineeLiveName14(blank)0015
10Name3Semi Qualified CALiveName3(blank)000134
11Name5Semi Qualified CALiveName5(blank)000150
12Name9Associate (Baroda)LiveName9(blank)10076
132Name1Associate/Sr. AssociateLiveName1(blank)30036
14Name13TraineeLiveName13(blank)500300
15Name2Associate/Sr. AssociateLiveName2(blank)10028
16Name4Finance & Account ManagerClosedName4(blank)0002
17Name6Team Leader (UK)LiveName6(blank)0002
18Name7Associate/Sr. Associate(UK)LiveName7(blank)0006
Sheet2
 
Last edited:
Upvote 0
Code:
=SUMPRODUCT((Sheet1!$B$4:$B$17=$B4)*(Sheet1!$C$4:$C$17=$C4)*(Sheet1!$E$4:$E$17=$E4)*(Sheet1!$G$1:$N$1>=DATEVALUE("1"&G$1))*(Sheet1!$G$1:$N$1<="&EOMONTH(DATEVALUE("1"&G$1),0))*(Sheet1!$G$2:$N$2=G$2)*Sheet1!$G$4:$N$17)
To help you know how it works: first 3 logical statement for 3 columns, next 3 (2 for date range and 1 for job decription), last: value range need to sum up.
 
Upvote 0
Solution
Code:
=SUMPRODUCT((Sheet1!$B$4:$B$17=$B4)*(Sheet1!$C$4:$C$17=$C4)*(Sheet1!$E$4:$E$17=$E4)*(Sheet1!$G$1:$N$1>=DATEVALUE("1"&G$1))*(Sheet1!$G$1:$N$1<="&EOMONTH(DATEVALUE("1"&G$1),0))*(Sheet1!$G$2:$N$2=G$2)*Sheet1!$G$4:$N$17)
To help you know how it works: first 3 logical statement for 3 columns, next 3 (2 for date range and 1 for job decription), last: value range need to sum up.

Thank you very much bebo021999
It works Great!
 
Upvote 0
file copy of my solution is at Box for your review

If you combine row 1 and row 2 of your source data, ie. 10/19/21 Openings, etc. Then bring the data to Power Query.
Power Query Mcode below and loaded to Data Model at the end.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Filtered Rows" = Table.SelectRows(Source, each ([#"Prority "] <> null)),
    #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows",{{"10/19/21Interviewed", "10/19/21 Interviewed"}, {"10/19/21Offered", "10/19/21 Offered"}, {"10/19/21Joined", "10/19/21 Joined"}, {"10/20/21Interviewed", "10/20/21 Interviewed"}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Renamed Columns", {"Prority ", "Manager", "Name of The Position", "Status", "Working At Profile", "Package"}, "Attribute", "Value"),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Attribute.1", "Attribute.2"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Attribute.1", type date}}),
    #"Extracted Month Name" = Table.TransformColumns(#"Changed Type", {{"Attribute.1", each Date.MonthName(_), type text}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Extracted Month Name",{{"Value", Int64.Type}})
in
    #"Changed Type1"

Once in the Data Model (Power Pivot), you can then pivot the data as below.

Book6
BCDEFGHIJK
3Sum of ValueAttribute.1Attribute.2
4October
5ProrityManagerName of The PositionStatusWorking At ProfilePackageInterviewedJoinedOfferedOpenings
61Name10CA Inter(Baroda)ClosedName10(blank)0002
7Name11CALiveName11(blank)00026
8Name12CALiveName12(blank)00028
9Name14TraineeLiveName14(blank)0015
10Name3Semi Qualified CALiveName3(blank)000134
11Name5Semi Qualified CALiveName5(blank)000150
12Name9Associate (Baroda)LiveName9(blank)10076
132Name1Associate/Sr. AssociateLiveName1(blank)30036
14Name13TraineeLiveName13(blank)500300
15Name2Associate/Sr. AssociateLiveName2(blank)10028
16Name4Finance & Account ManagerClosedName4(blank)0002
17Name6Team Leader (UK)LiveName6(blank)0002
18Name7Associate/Sr. Associate(UK)LiveName7(blank)0006
Sheet2

Thank you alansidman for you reply

will power query work in Excel 2013?
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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