+ Reply to Thread
Results 1 to 19 of 19

count number of rows that falls in 2014

Hybrid View

  1. #1
    Registered User
    Join Date
    11-18-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2010
    Posts
    42

    count number of rows that falls in 2014

    Hi,

    I have an excel sheet which contains huge data, almost 60k rows, I want to count that how many rows are in 2014.

    E.g. March- 04, 2014. June 16, 2015.

    Due to some reason I don't want to sort the dates nor apply filters. I thought of combining countif with right formula but didn't get the desired result.

    Can any one help me here

  2. #2
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: count number of rows that falls in 2014

    Hi,use the formula :
    Formula: copy to clipboard
    =SUMPRODUCT(--(YEAR(Range)=2014))


    where Range is the column containing dates.

  3. #3
    Registered User
    Join Date
    11-18-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2010
    Posts
    42

    Re: count number of rows that falls in 2014

    Thanks for the reply.... but it didn't solve the whole problem. The issue is that some of the dates are not formatted correctly and there are some unusual dates like December 35, 2014. I think that this formula will not count these, right???

    So it would really help me if a formula contains RIGHT in it.

  4. #4
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: count number of rows that falls in 2014

    Assuming that all dates have the year at the end and there is a full stop also (Eg: 2014.)
    use the formula
    Formula: copy to clipboard
    =SUMPRODUCT(--(LEFT(RIGHT(Range,5),4)="2014"))

  5. #5
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: count number of rows that falls in 2014

    Hi Fahad,

    Adding this a non-array solution:

    =COUNTIFS(A2:A28,">=1/1/2014",A2:A28,"<=31/12/2014")+COUNTIF(A2:A28,"*2014*")

    Regards,
    Khalid

  6. #6
    Forum Contributor
    Join Date
    08-29-2012
    Location
    Slough
    MS-Off Ver
    Excel 2007
    Posts
    469

    Re: count number of rows that falls in 2014

    Missed the criteria on this. Above works anyway.
    Last edited by DannyJ; 12-05-2016 at 05:52 AM.

  7. #7
    Registered User
    Join Date
    11-18-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2010
    Posts
    42

    Re: count number of rows that falls in 2014

    I tried this but it didn't work, There is no "." in the dates so I amended the formula but result is 0.

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,418

    Re: count number of rows that falls in 2014

    Try this:

    =SUMPRODUCT(--(ISNUMBER(SEARCH("2014",range))))

    You need to put in the range where your dates occur, e.g. D2:D2000

    Hope this helps.

    Pete

  9. #9
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: count number of rows that falls in 2014

    Try this:

    =SUMPRODUCT(--(ISNUMBER(SEARCH("2014",range))))

    You need to put in the range where your dates occur, e.g. D2:D2000

    Hope this helps.

    Pete


    That should nail it !!!!

  10. #10
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: count number of rows that falls in 2014

    The formula using RIGHT doesn't work when it is formatted as date.
    Please post sample file.

  11. #11
    Forum Contributor
    Join Date
    02-07-2013
    Location
    Karachi, Pakistan
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: count number of rows that falls in 2014

    Hi Fahad,

    Post a sample excel file with some example of various type of dates.

    Regards,

  12. #12
    Registered User
    Join Date
    11-18-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2010
    Posts
    42

    Re: count number of rows that falls in 2014

    Here is a sample sheet
    Attached Files Attached Files

  13. #13
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,418

    Re: count number of rows that falls in 2014

    You can use this array* formula for your sample file:

    =SUM(IF(ISNUMBER(A2:A28),IF(YEAR(A2:A28)=2014,1,0),IF(RIGHT(A2:A28,4)="2014",1,0)))

    Change the range (A2:A28, which occurs 3 times in the formula) to suit your real file.

    *Note: an array formula needs to be committed using the key combination Ctrl-Shift-Enter (CSE), rather than the usual < Enter >.

    Hope this helps.

    Pete

  14. #14
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,418

    Re: count number of rows that falls in 2014

    Change the entry in A13 to this:

    38/07/2014

    John's formula does not count it.

    Pete

  15. #15
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,820

    Re: count number of rows that falls in 2014

    Try

    =SUMPRODUCT(--(IFERROR(YEAR(A2:A28)=2014,0)))

    Enter with Ctrl+Shift+enter

  16. #16
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    447

    Re: count number of rows that falls in 2014

    Quote Originally Posted by JohnTopley View Post
    Try

    =SUMPRODUCT(--(IFERROR(YEAR(A2:A28)=2014,0)))

    Enter with Ctrl+Shift+enter

    Works well!!

  17. #17
    Registered User
    Join Date
    11-18-2016
    Location
    Islamabad, Pakistan
    MS-Off Ver
    2010
    Posts
    42

    Re: count number of rows that falls in 2014

    Thank you sooooo much.....

  18. #18
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,820

    Re: count number of rows that falls in 2014

    Note: Pete's formula counts "rogue" dates e.g. 32/12/2014 whereas mine ignores them so I would advise using Pete's formula.

    Or better: find and correct the rogue dates.

  19. #19
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,820

    Re: count number of rows that falls in 2014

    @Pete: beat me to it!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Date Formatting 10.9.2014 to 9/10/2014
    By cory0789 in forum Excel General
    Replies: 7
    Last Post: 10-12-2014, 11:38 AM
  2. [SOLVED] Date order 2014-02-24 > 24-02-2014
    By Shimazu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2014, 06:00 AM
  3. Replies: 3
    Last Post: 01-30-2014, 08:19 PM
  4. Replies: 3
    Last Post: 11-18-2013, 02:06 AM
  5. Replies: 1
    Last Post: 01-17-2013, 10:44 AM
  6. [SOLVED] Filtering macro, count number of rows and include count in last column.
    By Folshot in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2012, 07:17 AM
  7. Count rows and insert number to count them.
    By Mex in forum Excel General
    Replies: 6
    Last Post: 08-22-2006, 09:35 PM

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