In real life data, sometimes you need to get a result by matching 2 or more criteria. In most cases we use Data Filter, to count or get the result manually. But when your time is too short to do this, then you need to depend on Advance Formula. Advance formulas are those where 2 or more Excel Functions included.
Sample Data:
Assume that, we have a data table like below image:
We have to get the Working Days in below Data Table:
(1) SUMIFS:
In I3 cell enter the below SUMIFS formula to get the result:
In SUMIFS formula first I have selected the "Working Days" column range $D$2:$D$12 from source data table, which I need to get. Then I have selected a range for First Criteria "Name" from the source data table as $A$2:$A$12 and mentioned the criteria as F2 ("Deb") from the target data table. Due to I need to drag this formula from I2 to I4 that is why I have selected the F2 instead of "Deb".
By this way, I have selected the second criteria range "Department" as $B$2:$B$12 from the source data table and selected the 2nd criteria G2 ("MIS") from the target data table. And finally third criteria range "Designation" as $C$2:$C$12 from the source data table has selected where H4 as third criteria from the target data table has selected.
(2) LOOKUP:
In I3 cell enter the below LOOKUP formula to get the result:
In this formula, 2 is the immediate bigger number then 1. In second attribute, ($A$2:$A$12=F2) is first condition, ($B$2:$B$12=G2) is second condition and ($C$2:$C$12=H2) is third condition applied.
Note that, all these three condition are added by ' * ' (Asterisk) character. Why? Because our goal is to meet 3 criteria and get the result. To match three criteria one after another I have set the these condition through AND (alternative character is ' * '). Yes! ' * ' means AND. Another thing is ' + ' (Plus) character means OR.
So, after adding ' * ' what is the condition? The condition is ($A$2:$A$12=F2) AND ($B$2:$B$12=G2) AND $C$2:$C$12=H2). If the criteria becomes TRUE then it becomes:
And then it will divide 1 like below:
Note that, after matching all 3 conditions, a numerical value 1 has found in 5th position. And from $D$2:$D$12 the 5th position value is 28 which will return.
(3) SUMPRODUCT:
In I3 cell enter the below SUMPRODUCT formula to get the result:
The 3 conditions are applied through ' * ' Asterisks key which is AND. After matching all three conditions the result will be:
In 5th position there is a TRUE value (TRUE = 1, FALSE = 0) found after matching 3 conditions. And the value of 5th position in $D$2:$D$12 range is 28.
(4) SUM Array formula:
In I3 cell enter the below SUM Array formula and press Ctrl+Shift+Enter to get the result:
In this Array formula, the 3 conditions are also applied through ' * ' Asterisks key which means AND. After matching all three conditions the result will be:
In 5th position there is a TRUE value (TRUE = 1, FALSE = 0) found after matching 3 conditions. And the value of 5th position in $D$2:$D$12 range is 28.
If you want to download this workbook, then Click the below .xlsx link:
Note:
1. If you want to get Numerical value as result, then you can use SUMIF, SUMIFS, SUMPRODUCT, SUM, Lookup, INDEX-MATCH formula.
2. If you want to get Text value as result, then you cannot use SUMIF, SUMIFS, SUMPRODUCT, SUM formula for lookup.
Sample Data:
Assume that, we have a data table like below image:
Image 1: Source Data Table
We have to get the Working Days in below Data Table:
Image 2: Target Data Table
(1) SUMIFS:
In I3 cell enter the below SUMIFS formula to get the result:
=SUMIFS($D$2:$D$12,$A$2:$A$12,$F2,$B$2:$B$12,$G2,$C$2:$C$12,$H2)
Image 3: Result through SUMIFS formula
In SUMIFS formula first I have selected the "Working Days" column range $D$2:$D$12 from source data table, which I need to get. Then I have selected a range for First Criteria "Name" from the source data table as $A$2:$A$12 and mentioned the criteria as F2 ("Deb") from the target data table. Due to I need to drag this formula from I2 to I4 that is why I have selected the F2 instead of "Deb".
By this way, I have selected the second criteria range "Department" as $B$2:$B$12 from the source data table and selected the 2nd criteria G2 ("MIS") from the target data table. And finally third criteria range "Designation" as $C$2:$C$12 from the source data table has selected where H4 as third criteria from the target data table has selected.
(2) LOOKUP:
In I3 cell enter the below LOOKUP formula to get the result:
=LOOKUP(2,1/(($A$2:$A$12=F2)*($B$2:$B$12=G2)*($C$2:$C$12=H2)),$D$2:$D$12)
Image 4: Result through LOOKUP formula
In this formula, 2 is the immediate bigger number then 1. In second attribute, ($A$2:$A$12=F2) is first condition, ($B$2:$B$12=G2) is second condition and ($C$2:$C$12=H2) is third condition applied.
Note that, all these three condition are added by ' * ' (Asterisk) character. Why? Because our goal is to meet 3 criteria and get the result. To match three criteria one after another I have set the these condition through AND (alternative character is ' * '). Yes! ' * ' means AND. Another thing is ' + ' (Plus) character means OR.
So, after adding ' * ' what is the condition? The condition is ($A$2:$A$12=F2) AND ($B$2:$B$12=G2) AND $C$2:$C$12=H2). If the criteria becomes TRUE then it becomes:
=LOOKUP(2,1/{0;0;0;0;1;0;0;0;0;0;0},$D$2:$D$12)
And then it will divide 1 like below:
=LOOKUP(2,{#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;1;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!;#DIV/0!},$D$2:$D$12)
Note that, after matching all 3 conditions, a numerical value 1 has found in 5th position. And from $D$2:$D$12 the 5th position value is 28 which will return.
(3) SUMPRODUCT:
In I3 cell enter the below SUMPRODUCT formula to get the result:
=SUMPRODUCT(($A$2:$A$12=$F2)*($B$2:$B$12=$G2)*($C$2:$C$12=$H2)*($D$2:$D$12))
Image 5: Result through SUMPRODUCT formula
The 3 conditions are applied through ' * ' Asterisks key which is AND. After matching all three conditions the result will be:
=SUMPRODUCT({0;0;0;0;1;0;0;0;0;0;0}*($D$2:$D$12))
In 5th position there is a TRUE value (TRUE = 1, FALSE = 0) found after matching 3 conditions. And the value of 5th position in $D$2:$D$12 range is 28.
(4) SUM Array formula:
In I3 cell enter the below SUM Array formula and press Ctrl+Shift+Enter to get the result:
=SUM(IF(($A$2:$A$12=$F2)*($B$2:$B$12=$G2)*($C$2:$C$12=$H2),$D$2:$D$12))
Image 6: Result through SUM Array formula
In this Array formula, the 3 conditions are also applied through ' * ' Asterisks key which means AND. After matching all three conditions the result will be:
=SUM(IF({0;0;0;0;1;0;0;0;0;0;0},$D$2:$D$12))
In 5th position there is a TRUE value (TRUE = 1, FALSE = 0) found after matching 3 conditions. And the value of 5th position in $D$2:$D$12 range is 28.
If you want to download this workbook, then Click the below .xlsx link:
Note:
1. If you want to get Numerical value as result, then you can use SUMIF, SUMIFS, SUMPRODUCT, SUM, Lookup, INDEX-MATCH formula.
2. If you want to get Text value as result, then you cannot use SUMIF, SUMIFS, SUMPRODUCT, SUM formula for lookup.