+ Reply to Thread
Results 1 to 4 of 4

COUNTIF where criteria compares year only in the range

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    Philadelphia, USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    COUNTIF where criteria compares year only in the range

    Hi,

    I searched the forum looking for an answer to my problem. I could not find it. My apology in advance if this post is a duplicate.

    Basically, I have a column F that has DATE formatted as mmmm-yy. In a different column K, I would like to add the number of times a particular year (yyyy) appears in column F. The particular year for comparison is the heading of column K and is formatted as yyyy.

    I thought the function to use would be COUNTIF(range, criteria) . Below is the formula I came up with. However, when I evaluate it, it shows me the criteria as True but the answer is zero. I cannot figure out what am I doing wrong.

    {=(COUNTIF('[Sheet Org.xlsx]Column F'!$F$65:$F$69,YEAR('[Sheet Org.xlsx]Column F'!$F$65:$F$69)=YEAR(K6)))}

    The column F rows 65-69 has exactly two dates with the Year 2015. They are displayed as Jan-15 and Apr-15. The column K heading (K6) has the year 2015 (formatted as yyyy). The answer should be 2.

    Any help would be appreciated.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: COUNTIF where criteria compares year only in the range

    FAL22,

    Welcome to the forum!
    Give this regular formula (no need to array enter) a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: COUNTIF where criteria compares year only in the range

    Try

    =COUNTIFS('[Sheet Org.xlsx]Column F'!$F$65:$F$69,">="&DATE(YEAR(K6),1,1),'[Sheet Org.xlsx]Column F'!$F$65:$F$69,"<"&DATE(YEAR(K6)+1,1,1))

  4. #4
    Registered User
    Join Date
    05-15-2013
    Location
    Philadelphia, USA
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: COUNTIF where criteria compares year only in the range

    Thank you both for your reply.

    I tried the SUMPRODUCT. That worked. I believe it works with Excel 2003 as well.

    COUNTIFS with the arguments as shown would work too. I was using COUNTIF thinking that it is only one criteria (with computation in it). Silly me!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1