# Finding the year of today's date in a Countifs Statement

I am trying to count records only if the referral month is 1 and the referral_start date iis within the current year.

I have name fields as follows   referral month      -      referral
referral_start_date -  start_date

I am getting a syntax error when I try to add the year comparison.  This is my statement . Can someone tell me what it should be?

=COUNTIFS(referral,1,year(start_date),year(TODAY()))
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
You can't apply a function like YEAR to any range in COUNTIFS so you either need to add an extra column with the year and use

=COUNTIFS(referral,1,extra_col,year(TODAY()))

or without extra column do this

=COUNTIFS(referral,1,start_date,">="&DATE(YEAR(TODAY()),1,1),start_date,"<"&DATE(YEAR(TODAY())+1,1,1))

i.e. test whether start date is greater than (or equal to) 1st jan in current year and less than 1st Jan next year

regards, barry
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
....or you could use SUMPRODUCT with the YEAR function but that's less efficient in general, i.e.

=SUMPRODUCT((referral=1)*(year(start_date)=year(TODAY())))

regards, barry
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.