COUNTIF - Depending On Various Factors?

StuFromSaturday

Board Regular
Joined
Nov 3, 2009
Messages
81
Hi all, wonder if you can help me out.

I've had a good look through the site and can't quite find an answer to this one I'm afraid. I have two columns of data; A contains the daily dates from 31/12/1999 to date, in that format, and B contains various values, but only on working weekdays.

Now, what I need to be doing in column C, is adding a COUNTIF that counts the number of non-zero values in column B, during the current year of column A. Or, to put it another way, how many days during the year specified in A1 is there a value in B (so the result, dragged down, will be something like 252, 252, 252, 252 and then once the year increases by one 251, 251, 251, 251).

I hope I've explained that all ok and that someone can help - I did see something about SUMIFS, but I don't have that option I'm afraid.

I'm using Excel 2003. Any help gratefully received.


Regards,


Stu
 

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.
=SUMPRODUCT(--(YEAR(A2:A100)=YEAR(A1)),--(B2:B100>0))

You won't be able to refer to entire columns (e.g A:A) so either change the ranges as required or use dynamic ranges.
 
Upvote 0
You don't hang about, do you?!

Superb, thank you...I'm gonna spend a while now getting my head round why it works, but thank you very much indeed!
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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