Don't count blank cells in sum array

mnunan

New Member
Joined
Apr 1, 2011
Messages
18
Hi

Can anybody help with correcting this sum array please?

I am trying to count the records in column L where the date in column D falls between the dates specified in cells B2 and C2. This is working just fine, except some of the cells in column D are blank and I don't want these counted but no matter what I have tried it keeps counting them. (content of column D is text).

Thanks for any help :biggrin:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi

Can anybody help with correcting this sum array please?

I am trying to count the records in column L where the date in column D falls between the dates specified in cells B2 and C2. This is working just fine, except some of the cells in column D are blank and I don't want these counted but no matter what I have tried it keeps counting them. (content of column D is text).

Thanks for any help :biggrin:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)
Ok, you first say column D are dates then you say column D is TEXT.

Which is it?

If column D is true Excel dates then this test will fail for truly empty cells:

'RAW DATA'!$D$2:$D$50000>=B2

So, are you sure the cells are truly empty?
 
Upvote 0
Hi

Thanks for answering and my apologies, I meant content of column L is text
OK, my point still applies...

If column D is true Excel dates then this test will fail for truly empty cells:

'RAW DATA'!$D$2:$D$50000>=B2

So, are you sure the cells are truly empty?

Also, if column L contains TEXT then why are you referencing it in the formula:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)
 
Upvote 0
Hi

Can anybody help with correcting this sum array please?

I am trying to count the records in column L where the date in column D falls between the dates specified in cells B2 and C2. This is working just fine, except some of the cells in column D are blank and I don't want these counted but no matter what I have tried it keeps counting them. (content of column D is text).

Thanks for any help :biggrin:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)

Control+shift+enter, not just enter:
Code:
=SUM(
    IF('RAW DATA'!$D$2:$D$50000>=B2,
    IF('RAW DATA'!$D$2:$D$50000<=C2,
      1-('RAW DATA'!$L$2:$L$50000=""))))
 
Upvote 0
Hi

Can anybody help with correcting this sum array please?

I am trying to count the records in column L where the date in column D falls between the dates specified in cells B2 and C2. This is working just fine, except some of the cells in column D are blank and I don't want these counted but no matter what I have tried it keeps counting them. (content of column D is text).

Thanks for any help :biggrin:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)
It would also help if we knew what version of Excel you're using.
 
Upvote 0
OK, my point still applies...



Also, if column L contains TEXT then why are you referencing it in the formula:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)

Because I only want to count the dates in column D where the corresponding row in column L is not blank, hope that makes sense. Am using 2007
 
Upvote 0
Control+shift+enter, not just enter:
Code:
=SUM(
    IF('RAW DATA'!$D$2:$D$50000>=B2,
    IF('RAW DATA'!$D$2:$D$50000<=C2,
      1-('RAW DATA'!$L$2:$L$50000=""))))

Yes this is set as an array but when you copy the formula from excel it doesn't insert the curly brackets :)
 
Upvote 0
Hi

Can anybody help with correcting this sum array please?

I am trying to count the records in column L where the date in column D falls between the dates specified in cells B2 and C2. This is working just fine, except some of the cells in column D are blank and I don't want these counted but no matter what I have tried it keeps counting them. (content of column D is text).

Thanks for any help :biggrin:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2),('RAW DATA'!$L$2:$L$50000),0)
Ok, I think I just realized what you were trying to say.

Column L has the empy cells, not column D.

You can modify your current formula to:

=SUM(('RAW DATA'!$D$2:$D$50000>=B2)*('RAW DATA'!$D$2:$D$50000<=C2)*('RAW DATA'!$L$2:$L$50000<>""))

Or, you can use this version:

=SUM(IF('RAW DATA'!$D$2:$D$50000>=B2,IF('RAW DATA'!$D$2:$D$50000<=C2,IF('RAW DATA'!$L$2:$L$50000<>"",1))))

Or, you can use this normally entered version which will work in any version of Excel:

=SUMPRODUCT--('RAW DATA'!$D$2:$D$50000>=B2),--('RAW DATA'!$D$2:$D$50000<=C2),--('RAW DATA'!$L$2:$L$50000<>""))

Or, if you're using Excel 2007 or later:

=COUNTIFS('RAW DATA'!D2:D50000,">="&B2,'RAW DATA'!D2:D50000,"<="&C2,'RAW DATA'!L2:L50000,"<>")

If you're using Excel 2007 or later then the COUNTIFS version is the best option.
 
Upvote 0
Ok, I think I just realized what you were trying to say.


Or, if you're using Excel 2007 or later:

=COUNTIFS('RAW DATA'!D2:D50000,">="&B2,'RAW DATA'!D2:D50000,"<="&C2,'RAW DATA'!L2:L50000,"<>")

If you're using Excel 2007 or later then the COUNTIFS version is the best option.

I used this version as advised and it worked instantly, thanks so much for your patience, have a good day :biggrin:
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,555
Members
452,928
Latest member
101blockchains

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