I am trying to SUM
values based on multiple criteria from a Power Query table (SQL download):
B28
in code below ) Month and Year of record ( also hard-coded for cell reference, also done )
ID of the person who recorded that. We have four teams for which I have assigned name range ( MI_Equities
, M_Bonds
, SSR_Equities
, SSR_Bonds
), with list of User IDs. This list is with different length.
Here is the formula that I am working with ( without last condition):
=(SUM(IF((tblAPP_Main[TypeError]=$B28)*(MONTH(tblAPP_Main[DateOccurence])=MONTH($K$2))*(YEAR(tblAPP_Main[DateOccurence])=YEAR($N$2))=1;1;0)))
This formula works until I add the below after the year condition:
*SUMPRODUCT((--ISNUMBER(SEARCH(MI_Equities;tblAPP_Main[CreatedBy]))))
From this formula I get the #VALUE!
error (for the values in array) and the #N/A
error for the others. I think I'm getting these errors because the matrix has a different length than the column I want to compare it with, but I'm not sure.
To show it in practice:
Let's say I have this table ( tblAPP_Main
):
and I need to count how many times there is the je* specified in the named range (ie je23575 is named MI_Equities
, so I want to use that name).
This should return number 1 , as 1 human mistake was made by that specific team.
I need my final table to look like this: .
Important note: It should not be calculation heavy and NOT scripted in VBA.
You can add a new column tblAPP_Main
called Team_Name
where you use an if
function with the team names to populate the column. (Essentially moving your named ranges into the new column)
To populate Table_Final
, use =countifs('tblAPP_Main'!$A:$A= tblAPP_Main$A2, 'tblAPP_Main'!$D:$D= 'tblAPP_Main'!B$1)
. (Column D is the new column that you just created.) The countifs should populate the table and you can use a sum function for the totals. Please let me know if this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.