COUNTIFS looking for non-blank values in a range

JimJohnson

New Member
Joined
Apr 29, 2008
Messages
36
Yes, I should be able to figure this out, but I'm getting fed up. This formula needs to do two things:

1.) Find a value exists or not in another range (easy)
2.) If above is true, determine how many non-blank cells there are in a range of columns for that particular value

For the sake of argument, assume that I'm looking for the value in column A and I'm looking for non-blanks in columns C, D and E.

Here is the best I could come up with:
=COUNTIFS($A:$A,value,$C:$C,"<>"&"")+COUNTIFS($A:$A,value,$D:$D,"<>"&"")+CCOUNTIFS($A:$A,value,$E:$E,"<>"&"")

It works, but in practice, I am counting non-blanks in a LOT of columns, which is going to be brutal on the calculation time in this worksheet.

Does anyone have a better way of doing this?

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hello Jim,

You can perhaps use SUMPRODUCT, e.g. with value in J1 try

=SUMPRODUCT((A2:A100=J1)*(C2:E100<>""))
 
Upvote 0
Hi Barry, thanks.

The value that I'm initially searching for is a name, not a number. I apologize, I should've included that in the initial post. So I don't believe SUMPRODUCT will work for me.
 
Upvote 0
Actually, it appears that I'm a bit of an idiot and didn't grasp how SUMPRODUCT works.

However, it appears that I cannot use SUMPRODUCT for multiple columns here either.

=SUMPRODUCT(--(A:A="value"),--(C:E>="")) turns up an error.

I think that I might end up having to write a macro for this. It's something I wanted to avoid, but it might end up being the most painless way.
 
Upvote 0
For multiple columns you need to use the syntax I suggested, multiplying rather than using --, i.e. for the whole column

=SUMPRODUCT((A:A="value")*(C:E<>""))

using the whole column will slow the function down somewhat, though, so I suggest restricting the ranges....

An array formula will also work, i.e.

=SUM(IF(A:A="value",IF(C:E<>"",1)))

confirmed with CTRL+SHIFT+ENTER

although the same caveat about whole columns applies
 
Last edited:
Upvote 0
It appears that you're right. I believe that works, but yes, that is way too resource-intensive to run. With the amount of data that I have, I don't think it's feasible.

Oh well, looks like I'm writing a macro to handle it. Thanks for the help, Barry.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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