+ Reply to Thread
Results 1 to 9 of 9

Extract data by month and year

  1. #1
    Registered User
    Join Date
    05-03-2023
    Location
    U.S.
    MS-Off Ver
    365
    Posts
    4

    Extract data by month and year

    I have a large 2 column data set that contains date & time and their corresponding values recorded every 15 minutes (mm-dd-yy h:mm format) for multiple years. I need to create a table that counts the number of data points >zero by month for each year. I titled and formatted the table columns by date, Jan-2020, Feb-2020, etc. off to the side in row 9. I want to search the data set based on the month and year of the column title. I have tried both of the following but get 0 (zero) as a result.

    =COUNTIFS($D$10:$D$35049,"="&DATE(YEAR(P$9),MONTH(P$9),1),F10:F35049,">0")
    =COUNTIFS($D$10:$D$35049,"="&MONTH(Q$9),$D$10:$D$35049,"="&YEAR(P$9), F10:F35049,">0")

    Where dates for the data are in column D, the data are in column F, and row 9 is the targeted month and year, which is column P in this example.

    Is there another way to do this?
    Attached Files Attached Files
    Last edited by Kekeken; 05-03-2023 at 12:35 PM. Reason: attachment

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    84,036

    Re: Extract data by month and year

    Welcome to the forum.

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    84,036

    Re: Extract data by month and year

    Choose the file - upload it - close the upload window and don’t forget to save.

  4. #4
    Registered User
    Join Date
    05-03-2023
    Location
    U.S.
    MS-Off Ver
    365
    Posts
    4

    Re: Extract data by month and year

    I retried the upload and it said it failed. Not sure why. Is there a size limit?

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Extract data by month and year

    1 Mb for .xlsx. It used to be higher for .xlsb, but I'm not sure that works.

    Anyway... it's a SAMPLE we want, 10-20 rows, not THOUSANDS,
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Extract data by month and year

    One way (of many):

    =COUNTIFS($C:$C,TEXT(P9,"mmm-yy"),$F:$F,">0")

    see file.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    05-03-2023
    Location
    U.S.
    MS-Off Ver
    365
    Posts
    4

    Re: Extract data by month and year

    Wow! That is so much simpler than what I thought was needed. Thank you. I wish I found this site yesterday.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Extract data by month and year

    One you find us... you cannot leave. there is no escape.

    Anyhow...

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  9. #9
    Registered User
    Join Date
    05-03-2023
    Location
    U.S.
    MS-Off Ver
    365
    Posts
    4

    Re: Extract data by month and year

    I tried a similar approach for finding the maximum, minimum and average values. For Maximum I used MAXIFS...[max_range, criteria_range1, criteria1,...] but it yields zero.

    =MAXIFS($C$10:$C$35053,$B$10:$B$35053,TEXT(J$4,"mmm-yy"))

    Where Column B has dates and C has the data.

    I tried putting the TEXT function in quotes but that errored.

    Thoughts?

+ 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. [SOLVED] Formula to extract Data based on Month & Year
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 10-17-2020, 09:17 AM
  2. [SOLVED] formula to extract month and year
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 07-25-2019, 01:24 PM
  3. Extract month number and year
    By Howardc1001 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-28-2019, 12:28 PM
  4. Extract month and year from a cell
    By Wojtek-AU in forum Excel - New Users/Basics
    Replies: 24
    Last Post: 08-15-2016, 02:56 AM
  5. [SOLVED] Extract Year, Month, Day from date
    By stoicy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-28-2016, 11:48 PM
  6. Extract Year, Month, Day from date
    By stoicy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2016, 01:41 PM
  7. Extract data based on month/year to a simple table.
    By maax555 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-15-2014, 09:55 AM

Tags for this Thread

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