Sumifs formula to return blank not 0

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
976
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Need excel formula help in sumifs or any other alternative I am fine.
if Data is proper as shown in Situation A, Getting Correct Output shown in Range(L1:N7)

Situation-2
I have some blank cell value as criteria ......I should get result shown in L15:N15
If Criteria are complete blank ......formula should give blank output not zero.

I have very long list Needs a correct formula to achive the task


Below sample Data with expected output

Book1
ABCDEFGHIJKLMNO
1Situation1Data SalaryCriteriaOutput IND Currency
2CountryPlayerQ1Q2Q3CurrencyCountryPlayerCurrencyQ1Q2Q3
3IndiaSachin500010100INDIndiaSachinIND500010100
4AustraliaPonting600020200INDAustraliaPontingAUD900040400
5IndiaDhoni800030300INDIndiaSachinIND500010100
6AustraliaPonting900040400AUDAustraliaPontingAUD900040400
7IndiaSehwag1000050500INDIndiaSehwagIND1000050500
8
9
10
11
12Situation2Data SalaryCriteriaOutput IND Currency
13CountryPlayerQ1Q2Q3CurrencyCountryPlayerCurrencyQ1Q2Q3
14IndiaSachin500010100INDIndiaSachinIND500010100
15AustraliaPonting600020200AustraliaPonting600020200Expected Output
16IndiaDhoni800030300INDIndiaSachinIND500010100
17AustraliaPonting900040400AUDAustraliaPontingAUD900040400
18IndiaSehwag1000050500IND000Expected Blank here
Salary
Cell Formulas
RangeFormula
L16:L18,L14,L3:L7L3=SUMIFS($C$3:$C$7,$A$3:$A$7,$H3,$B$3:$B$7,$I3,$F$3:$F$7,$J3)
M16:M18,M14,M3:M7M3=SUMIFS($D$3:$D$7,$A$3:$A$7,$H3,$B$3:$B$7,$I3,$F$3:$F$7,$J3)
N16:N18,N14,N3:N7N3=SUMIFS($E$3:$E$7,$A$3:$A$7,$H3,$B$3:$B$7,$I3,$F$3:$F$7,$J3)



Thanks
mg
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Here is one approach. There are several ways to display blanks rather than 0's. I used a custom number format that involves selecting the entire answer range, right click Format Cells > Number > Custom, then paste 0;–0;;@ into the "Type" box and confirm with OK.
MrExcel20210428.xlsx
ABCDEFGHIJKLMN
12Situation2Data SalaryCriteriaOutput IND Currency
13CountryPlayerQ1Q2Q3CurrencyCountryPlayerCurrencyQ1Q2Q3
14IndiaSachin500010100INDIndiaSachinIND500010100
15AustraliaPonting600020200AustraliaPonting600020200
16IndiaDhoni800030300INDIndiaSachinIND500010100
17AustraliaPonting900040400AUDAustraliaPontingAUD900040400
18IndiaSehwag1000050500IND   
Sheet6
Cell Formulas
RangeFormula
L14:N18L14=SUMPRODUCT(INDEX($C$14:$E$18,,MATCH(L$13,$C$13:$E$13,0)),($A$14:$A$18=$H14)*($B$14:$B$18=$I14)*($F$14:$F$18=$J14))
 
Upvote 0
TextBox Line.xlsm
ABCDEFGHIJKLMN
1Situation1Data SalaryCriteriaOutput IND Currency
2CountryPlayerQ1Q2Q3CurrencyCountryPlayerCurrencyQ1Q2Q3
3IndiaSachin500010100INDIndiaSachinIND500010100
4AustraliaPonting600020200INDAustraliaPontingAUD900040400
5IndiaDhoni800030300INDIndiaSachinIND500010100
6AustraliaPonting900040400AUDAustraliaPontingAUD900040400
7IndiaSehwag1000050500INDIndiaSehwagIND1000050500
Sheet1
Cell Formulas
RangeFormula
L3:N3L3=IF(AND($H3="",$I3="",$J3=""),"",SUMPRODUCT(($A3:$A7=$H3)*($B3:$B7=$I3)*($F3:$F7=$J3)*1,C3:C7))
L4:N4L4=IF(AND($H4="",$I4="",$J4=""),"",SUMPRODUCT(($A3:$A7=$H4)*($B3:$B7=$I4)*($F3:$F7=$J4)*1,C3:C7))
L5:N5L5=IF(AND($H5="",$I5="",$J5=""),"",SUMPRODUCT(($A3:$A7=$H5)*($B3:$B7=$I5)*($F3:$F7=$J5)*1,C3:C7))
L6:N6L6=IF(AND($H6="",$I6="",$J6=""),"",SUMPRODUCT(($A3:$A7=$H6)*($B3:$B7=$I6)*($F3:$F7=$J6)*1,C3:C7))
L7:N7L7=IF(AND($H7="",$I7="",$J7=""),"",SUMPRODUCT(($A3:$A7=$H7)*($B3:$B7=$I7)*($F3:$F7=$J7)*1,C3:C7))
 
Upvote 0
Hi zote and Krice,

Thanks for your help, I tried sumproduct its working, but when I try formula for multiple cells it produce single value, on actual project.

I am Not good in Sumproduct can you suggest sumifs formula.





Thanks
mg
 
Upvote 0
Hi zote and Krice,

Thanks for your help, I tried sumproduct its working, but when I try formula for multiple cells it produce single value, on actual project.

I am Not good in Sumproduct can you suggest sumifs formula.





Thanks
mg
Not sure what you meant by multiple cell single value.

Actually that SUMPRODUCT is very straightforward
SUMPRODUCT(($A3:$A7=$H3)*($B3:$B7=$I3)*($F3:$F7=$J3)*1,C3:C7).
If
($A3:$A7=$H3) = TRUE
($B3:$B7=$I3) = TRUE
($F3:$F7=$J3) = TRUE
then
TRUE*TRUE*TRUE=1

Maybe I should have removed *1 in
SUMPRODUCT(($A3:$A7=$H3)*($B3:$B7=$I3)*($F3:$F7=$J3)*1,C3:C7)

so it is just
SUMPRODUCT(1,C3:C7) or SUM (1*C3:C7)

I will try SUMIF later
 
Upvote 0
Using SUMIFS
Opps copy wrong one
 
Upvote 0
SUMPRODUCT.xlsx
ABCDEFGHIJKLMN
1Situation1Data SalaryCriteriaOutput IND Currency
2CountryPlayerQ1Q2Q3CurrencyCountryPlayerCurrencyQ1Q2Q3
3IndiaSachin500010100INDIndiaSachinIND500010100
4AustraliaPonting600020200INDAustraliaPontingAUD900040400
5IndiaDhoni800030300INDIndiaSachinIND500010100
6AustraliaPonting900040400AUDAustraliaPontingAUD900040400
7IndiaSehwag1000050500INDIndiaSehwagIND1000050500
Sheet1
Cell Formulas
RangeFormula
L3:N3L3=IF(AND($H3="",$I3="",$J3=""),"",SUMIFS(C3:C7,$A$3:$A$7,$H3,$B$3:$B$7,$I3,$F$3:$F$7,IF(ISBLANK($J3),"",$J3)))
L4:N4L4=IF(AND($H4="",$I4="",$J4=""),"",SUMIFS(C3:C7,$A$3:$A$7,$H4,$B$3:$B$7,$I4,$F$3:$F$7,IF(ISBLANK($J4),"",$J4)))
L5:N5L5=IF(AND($H5="",$I5="",$J5=""),"",SUMIFS(C3:C7,$A$3:$A$7,$H5,$B$3:$B$7,$I5,$F$3:$F$7,IF(ISBLANK($J5),"",$J5)))
L6:N6L6=IF(AND($H6="",$I6="",$J6=""),"",SUMIFS(C3:C7,$A$3:$A$7,$H6,$B$3:$B$7,$I6,$F$3:$F$7,IF(ISBLANK($J6),"",$J6)))
L7:N7L7=IF(AND($H7="",$I7="",$J7=""),"",SUMIFS(C3:C7,$A$3:$A$7,$H7,$B$3:$B$7,$I7,$F$3:$F$7,IF(ISBLANK($J7),"",$J7)))
 
Upvote 0
@Mallesh23, I suspect you are getting a single value because the cell references need to be adjusted for your actual project. It sounds as if you may have all of the cell references locked (with the $ symbol). I noticed in your original post (that used SUMIFS) that the "Situation 2" block still referenced source information in the Situation 1 block, rather than source data found in columns A, B, C, and F in the Situation 2 table, as shown by the highlighted cells in this image. Here I selected cell L14 (an output in the Situation 2 section) and clicked on the formula in the formula bar to highlight the cells used. Have you confirmed that the formulas are referring to the correct ranges?
1619700160603.png
 
Upvote 0
@Mallesh23, I suspect you are getting a single value because the cell references need to be adjusted for your actual project. It sounds as if you may have all of the cell references locked (with the $ symbol). I noticed in your original post (that used SUMIFS) that the "Situation 2" block still referenced source information in the Situation 1 block, rather than source data found in columns A, B, C, and F in the Situation 2 table, as shown by the highlighted cells in this image. Here I selected cell L14 (an output in the Situation 2 section) and clicked on the formula in the formula bar to highlight the cells used. Have you confirmed that the formulas are referring to the correct ranges?
View attachment 37758
Yes, I saw that but I thought he was aware of it :unsure:
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,752
Members
448,989
Latest member
mariah3

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