Skip to main content

New Article

How to SUM by matching partial text in Excel

Get Numerical result by matching 3 conditions through SUMIFS, LOOKUP, SUMPRODUCT and SUM

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:

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.

Popular posts from this blog

How to display an image in worksheet based on a List or based on IF condition?

Excel can show image on worksheet based on a specific IF condition. So, how to do it? Simple follow the below steps: Step by Step: Step 1: Insert images in your Excel Worksheet. Here I've inserted 5 different types of balls, Football, Cricket, Pool, Basketball, Tennis ball. Note that, All balls are placed into different cell. These are placed in Picture sheet. Image 1: 5 balls placed in 5 different cells and covered photo's wide and height Step 2: In the report sheet, design the report as you wish. I've designed in my way like below: Image 2: Kids asking to Donald Duck, which ball need to throw now Step 3: Make a drop down list "Games" in E6 cell in Report sheet from Data Validation. which is as below: Football Cricket Pool Basketball Tennis You can do an IF function here in E6 in Report sheet, which will meet a certain condition and returned Football, Cricket, Pool, Basketball or Tennis. Step 4: Now the tricky part is

Fiverr Microsoft Excel 2016 Skill Test and Answers 2021

This video will help you about preparing Fiverr Excel Skill Test. I've just taken this Fiverr Excel Skill Test and successfully passed with a scored 6 out of 10. I'm sharing my Fiverr Excel Skill Test and Answers 2021 video so that you can prepare yourself if you would like to give a test on Fiverr.    I have taken the Fiverr Excel Skill Test on Fiverr and obtained 6 out of 10 scores. If you take a test and pass, it will greatly help the buyer to trust you and your skills. Please note that your exam will not be exactly the same as mine because there are many more questions in the pool than 40 which appeared in my test. But I am hopeful that you will succeed in it. If you have any queries, please write them in the comment section. I will try my best to guide you.Follow this video and try to get a general idea. By following the instructions, you can successfully pass the test.    After passing the Fiverr Excel Skill Test, Fiverr shared a Excel Expert Badge on my Profile, so that

Cumulative Closing Balance like a Bank Statement in PivotTable

A Bank Employee in many case needs to calculate the Closing Balance after each transaction in PivotTable like a Bank Statement . But with the help of Calculated Field of a PivotTable , you can only calculate Field with Field . It's not possible to use a formula in Calculated Field where you can mention a single cell with Relative Reference Cell . Because a PivotTable acts like a Table format where you can work with Field or Column Name . A Helping Column (A regular column, that helps to get a partial result where formula applied) can be a good idea. But there is an option in PivotTable by which you can Calculate Cumulative . In this article I will show you, how you can do it. Calculating with Formula: Assume that, you have an Excel file with Debit and Credit transaction of an Account . Image 1: Sample Bank Statement In a Bank Statement , Month wise Cumulative Balance is important. In the Excel sheet, as above, it is very easy to use a formula and calc