countif question

xoxo

Board Regular
Joined
Mar 29, 2009
Messages
198
Right now I have a code for counting numbers between 29 - 42.

=COUNTIF(B3:F3,">=29")-(COUNTIF(B3:F3,">42"))

Right now the code above gave me a 0, indicating there is no number between 29 - 42.

Is there another method to have no number show up at all, not even a 0 if there is no numbers between 29 - 42? I just want the cell leave it blank instead of putting a 0.

Thanks.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Having a problem posting.

Try:

=IF(COUNTIF(B3:F3,">=29")-(COUNTIF(B3:F3,">42"))=0,"",COUNTIF(B3:F3,">=29")-(COUNTIF(B3:F3,">42")))
 
Last edited:
Upvote 0
Or, the cell can be custom formatted to hide zero values...

Format > Cell > Number > Custom > Type: 0;-0;;@
 
Upvote 0
Having a problem posting.

Try:

=IF(COUNTIF(B3:F3,">=29")-(COUNTIF(B3:F3,">42"))=0,"",COUNTIF(B3:F3,">=29")-(COUNTIF(B3:F3,">42")))

This is exactly what I am looking for! It works beautifully. Thank you.
 
Upvote 0
Or, the cell can be custom formatted to hide zero values...

Format > Cell > Number > Custom > Type: 0;-0;;@

Thank you for the help. It only hides it but it's still there. hiker95's code is what I am looking for.
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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