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.
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

hiker95

Well-known Member
Joined
Apr 8, 2009
Messages
17,649
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:

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,406
Or, the cell can be custom formatted to hide zero values...

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

xoxo

Board Regular
Joined
Mar 29, 2009
Messages
198
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.
 

xoxo

Board Regular
Joined
Mar 29, 2009
Messages
198
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,497
Messages
5,596,508
Members
414,073
Latest member
Contilly

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
Top