Sumifs with criteria from Dynamic Lists

scojax22

New Member
Joined
Apr 1, 2014
Messages
12
Office Version
  1. 365
Platform
  1. Windows
LocationDepartmentYearMonthValue
MainInternal Medicine
2023​
Jan2,101
MainInternal Medicine
2023​
Feb1,833
MainInternal Medicine
2024​
Jan2,138
MainInternal Medicine
2024​
Feb-
ParkInternal Medicine
2023​
Jan-
ParkInternal Medicine
2023​
Feb500
ParkInternal Medicine
2023​
Mar-
ParkInternal Medicine
2024​
Jan178
ParkInternal Medicine
2024​
Feb-
MainPediatrics
2023​
Jan2,411
MainPediatrics
2023​
Feb2,150
MainPediatrics
2024​
Jan1,915
MainPediatrics
2024​
Feb-
ParkPediatrics
2023​
Jan-
ParkPediatrics
2023​
Feb-
ParkPediatrics
2024​
Jan1,018
ParkPediatrics
2024​
Feb-
HolmdelDental
2023​
Jan2,475
HolmdelDental
2023​
Feb2,283
HolmdelDental
2024​
Jan2,657
HolmdelDental
2024​
Feb-
HolmdelPediatrics
2023​
Jan542
HolmdelPediatrics
2023​
Feb365
HolmdelPediatrics
2024​
Jan478
HolmdelPediatrics
2024​
Feb-

I have the above Table. I want to use Sumifs to add the values for multiple Locations and Department data, which will be linking to Dynamic lists. So my list(s) may have 1 location and 1 department or 5 locations and 3 departments, etc. I was using something like this, but it was giving me inaccurate results:

=sum(SUMIFS(EncounterData[Value],EncounterData[Location],UNIQUE(FILTER(O1:O5,O1:O5<>"")),EncounterData[Department],UNIQUE(FILTER(P1:P5,P1:P5<>"")),EncounterData[Month],M1))

Any help would be greatly appreciated.
 
Last edited by a moderator:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
How about
Excel Formula:
=sum(SUMIFS(EncounterData[Value],EncounterData[Location],UNIQUE(FILTER(O1:O5,O1:O5<>"")),EncounterData[Department],torow(UNIQUE(FILTER(P1:P5,P1:P5<>""))),EncounterData[Month],M1))
When using 2 arrays one has to vertical & the other horizontal.
 
Upvote 0
Solution
Brilliant. I don't need for my current purposes, bu would you be able to add a 3rd array to the equation, or no because you now have a vertical and a horizontal?

Either way, thanks!
 
Upvote 0
No, you can only have two arrays in sumifs, but you could use the filter function, or sumproduct if you need more.
 
Upvote 0
You did not indicate your reporting requirement or provide examples of the results that you require.

Two additional ideas using a Table of your data are:
1. result at top based on the criteria selected.
2. Pivotby function which is a Beta function; I do not know when it will be available for regular Excel 365.

Sumifs.xlsm
ABCDE
1Total based on the Filtered Data or no Filters23,044
2LocationDepartmentYearMonthValue
3MainInternal Medicine202312,101
4MainInternal Medicine202321,833
5MainInternal Medicine202412,138
6MainInternal Medicine20242-
7ParkInternal Medicine20231-
8ParkInternal Medicine20232500
9ParkInternal Medicine20233-
10ParkInternal Medicine20241178
11ParkInternal Medicine20242-
12MainPediatrics202312,411
13MainPediatrics202322,150
14MainPediatrics202411,915
15MainPediatrics20242-
16ParkPediatrics20231-
17ParkPediatrics20232-
18ParkPediatrics202411,018
19ParkPediatrics20242-
20HolmdelDental202312,475
21HolmdelDental202322,283
22HolmdelDental202412,657
23HolmdelDental20242-
24HolmdelPediatrics20231542
25HolmdelPediatrics20232365
26HolmdelPediatrics20241478
27HolmdelPediatrics20242-
7c
Cell Formulas
RangeFormula
E1E1=SUBTOTAL(109,$E$3:$E$26)



Sumifs.xlsm
ABCDEFGH
1
2
3MainInternal Medicine202312,101
4ParkPediatrics202421,018
5HolmdelDental32,475
6
7N.B. The following is a Beta function; it is not in regular versions of Excel.
8 20232023202320242024Total
912312
10HolmdelDental2,4752,2832,65707,415
11HolmdelPediatrics54236547801,385
12MainInternal Medicine2,1011,8332,13806,072
13MainPediatrics2,4112,1501,91506,476
14ParkInternal Medicine050001780678
15ParkPediatrics001,01801,018
16Total7,5297,13108,384023,044
17
7c_
Cell Formulas
RangeFormula
A3:A5A3=UNIQUE(DataT[Location])
B3:B5B3=UNIQUE(DataT[Department])
C3:C4C3=UNIQUE(DataT[Year])
D3:D5D3=UNIQUE(DataT[Month])
E3E3=SUMIFS(DataT[Value],DataT[Location],A3,DataT[Department],B3,DataT[Year],C3,DataT[Month],D3)
E4E4=SUMIFS(DataT[Value],DataT[Location],A4,DataT[Department],B4,DataT[Year],C4,DataT[Month],D3)
E5E5=SUMIFS(DataT[Value],DataT[Location],A5,DataT[Department],B5,DataT[Year],C3,DataT[Month],D3)
A8:H16A8=PIVOTBY(DataT[[Location]:[Department]],DataT[[Year]:[Month]],DataT[Value],SUM)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,445
Messages
6,172,177
Members
452,446
Latest member
walkman99

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