Need to ignore blank cells

theta

Well-known Member
Joined
Jun 9, 2009
Messages
960
Hi

I have the following formula, but if i get a blank in the range it falls over.

How can I ignore blank rows?

=SUMPRODUCT(--(1/COUNTIF(SINGLE!B13:B48,SINGLE!B13:B48)<1),--(1/COUNTIF(SINGLE!B13:B48,SINGLE!B13:B48)))
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What is this formula meant to do? Can you provide some sample data as well as desired outcome?
 
Upvote 0
It just looks at numbers in column B (in the range B13:B48). If a number appears more than once, it will be counted.

So 1,2,3,4,4,4,5,6,7 would equal a count of 1 (the multiple 4 would produce a 1/COUNTIF of less than one so it will be counted)
 
Upvote 0
Any ideas at all?

If a blank / zero if present I get a DIV/0 error

Have tried excluding blank zero but doesn't work
 
Upvote 0
Sample :

1
2
3
4
4
4
5
6
7

Desired result = 1 (counted the duplicate item)


1
2
2
3
4
4
4

Desired result = 2 (counted 2 duplicate items)


1

2
4
4

Desired result = 1 (ignored blank and counted duplicate item)
 
Upvote 0
Would you be open to a VBA User-Defined-Function alternative? Also, would the data always be sorted in a fashion that the data is grouped like that?
 
Upvote 0
Can't use any VBA or project..everything locked down tight

It is possible with formulas

I am half way there, just need the countif to ignore blanks as they obv return a DIV/0 error when trying to divide blank by count
 
Upvote 0
This is a step closer, but I prefer sumproduct solution and also this formula does not distinguish between duplicates and non-duplicates

Just some testing

=SUM(IF(COUNTIF(C13:C30,C13:C30)=0,0,1/COUNTIF(C13:C30,C13:C30)))
 
Upvote 0
Hi

I have the following formula, but if i get a blank in the range it falls over.

How can I ignore blank rows?

=SUMPRODUCT(--(1/COUNTIF(SINGLE!B13:B48,SINGLE!B13:B48)<1),--(1/COUNTIF(SINGLE!B13:B48,SINGLE!B13:B48)))
Control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(SINGLE!$B$13:$B$48<>"",
   MATCH("~"&SINGLE!$B$13:$B$48,SINGLE!$B$13:$B$48&"",0)),
    ROW(SINGLE!$B$13:$B$48)-ROW(SINGLE!$B$13)+1)>1,1))
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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