SUMIF that returns a Zero if only Zeros have been entered, but returns a blank if nothing entered

Helluvaname

New Member
Joined
Jan 27, 2006
Messages
15
Hi excel guru's, I hope you can help an excel novice!

I have a budget sheet with the following data:

Col B = An expense category ref (usually a number)
Col J = Amount Spent
Rows 53 : 118 contain the above data

I'd like to have a cell (say K5) that displays the sum of the values in Col J, where a specified "category ref" appears in Col B, and to do that I am using:
=SUMIF(B$53:B$118,B5,J$53:J$118) where B5 contains the desired "category ref"

However, I'd like K5 to display 0 if there are entries in the range J53:J118 (where there is the required "category ref" in B53:B118) that contain 0, which it does BUT, I'd like K5 to be blank if there are no entries in the range.

Hopefully that makes sense and someone can suggest a simple solution?! (did I mention I'm a novice!)
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
does this work for you

=IF( COUNTIF( B$53:B$118,B5)=0, "", SUMIF(B$53:B$118,B5,J$53:J$118))

So if the Catergory Ref , in B5 does not exist , rather than zero it would be blank, but if it does exist with a zero result it will still display zero 0
 
Upvote 0
This should do it
Excel Formula:
=IF(COUNTIFS($B$53:B$118,B5,J$53:J$118,"<>"),SUMIFS(J$53:J$118,B$53:B$118,B5),"")
 
Upvote 0
Solution
does this work for you

=IF( COUNTIF( B$53:B$118,B5)=0, "", SUMIF(B$53:B$118,B5,J$53:J$118))

So if the Catergory Ref , in B5 does not exist , rather than zero it would be blank, but if it does exist with a zero result it will still display zero 0
Sorry probably my explanation, but it's if the data in J53:J118 is blank that I wanted the result in K5 to be blank.
 
Upvote 0
@jasonb75 sorry one more question:
I'd like a "balance column to also show a zero or blank (or sum result) depending on the result of the spend column.
I've attached the above example to show what I mean.
Is that easy to do?
 

Attachments

  • Blank display sheet.jpg
    Blank display sheet.jpg
    61.4 KB · Views: 12
Upvote 0
That one is a bit easier
Excel Formula:
=IF(K5="","",J5-K5)
I'm guessing that you made an error in row 6? 100 - 0 = 0 ?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

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