+ Reply to Thread
Results 1 to 17 of 17

Formula for counting rain days of the year, month, and or week

  1. #1
    Forum Contributor
    Join Date
    03-22-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2013
    Posts
    124

    Formula for counting rain days of the year, month, and or week

    Hi Guys,

    I need to count the number of days it rained of a given time (year,month, and week).

    I have rainfall data of 2 years with 30 mins data interval and I need to summarize the rain days of the year, the month of a given year, and the week of the given year (week 5 for example). I can't think of a formula to solve this since my data is in 30 mins interval not daily.

    please see this link below to see my data sheet;
    https://www.dropbox.com/s/p58ao5lh9e...days.xlsx?dl=0

    or see attached.

    Any help would be greatly appreciated.

    Thanks,
    DEAN
    Attached Files Attached Files
    Last edited by dedark05; 05-24-2016 at 01:32 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula for counting rain days of the year, month, and or week

    See if this works for you...
    G6=COUNTIFS(C:C,">0",A:A,">="&DATE(F6,1,1),A:A,"<="&DATE(F6,12,31))
    I6=COUNTIFS(C:C,">0",A:A,">="&DATEVALUE(1&H6),A:A,"<"&EDATE(DATEVALUE(1&H6),1))
    for the week num, I used a helper that you can hide if needed...
    D3=WEEKNUM(A3)&", "&YEAR(A3)
    copied down

    then I changed J6 etc to just 1, 2015
    K6=COUNTIFS(C:C,">0",D:D,J6)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Formula for counting rain days of the year, month, and or week

    put it in a pivot table?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Forum Contributor
    Join Date
    03-22-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2013
    Posts
    124

    Re: Formula for counting rain days of the year, month, and or week

    Quote Originally Posted by FDibbins View Post
    See if this works for you...
    G6=COUNTIFS(C:C,">0",A:A,">="&DATE(F6,1,1),A:A,"<="&DATE(F6,12,31))
    I6=COUNTIFS(C:C,">0",A:A,">="&DATEVALUE(1&H6),A:A,"<"&EDATE(DATEVALUE(1&H6),1))
    for the week num, I used a helper that you can hide if needed...
    D3=WEEKNUM(A3)&", "&YEAR(A3)
    copied down

    then I changed J6 etc to just 1, 2015
    K6=COUNTIFS(C:C,">0",D:D,J6)
    Hi FDibbins,

    It is not counting as days. I think it is counting the 30mins interval of the data not days.

    for years, it is counting more than 365 days, for the month it is counting more than 31, and for the week more than 7.

    Regards,
    Dean

  5. #5
    Forum Contributor
    Join Date
    03-22-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2013
    Posts
    124

    Re: Formula for counting rain days of the year, month, and or week

    Quote Originally Posted by humdingaling View Post
    put it in a pivot table?
    Hi humdingaling,

    I have been asked not to use PIVOT table.

    Regards,
    Dean

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula for counting rain days of the year, month, and or week

    Hum, Im trying to put a PT together, as suggested, but...
    1. how would you get week nums?
    2. how do you exclude 0's?

    F
    G
    H
    I
    J
    K
    L
    M
    N
    5
    year rain days month rain days week rain days 2015
    6
    2015
    1733
    January 2015
    292
    1, 2015
    20
    Jan
    1485
    7
    2016
    930
    February 2015
    175
    2, 2015 Feb
    1340
    8
    March 2015
    146
    3, 2015 Mar
    1487
    9
    January 2016
    224
    wk. 4, 2015 Apr
    1440
    10
    February 2016
    252
    May
    1487
    11
    March 2016
    105
    Jun
    1440
    12
    Jul
    1488
    13
    Aug
    1488
    14
    Sep
    1440
    15
    Oct
    1488
    16
    Nov
    1440
    17
    Dec
    1488
    18
    2016
    6778



    M:N are a PT

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Formula for counting rain days of the year, month, and or week

    very well

    using two helper columns

    the bottom numbers was me checking the answers of which i had a pivot table method
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Formula for counting rain days of the year, month, and or week

    Ford
    with Pivot method you need a side helper for it

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula for counting rain days of the year, month, and or week

    OK, kinda like what I used for the week/year

  10. #10
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Formula for counting rain days of the year, month, and or week

    Reattached file with pivot table and helper
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-22-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2013
    Posts
    124

    Re: Formula for counting rain days of the year, month, and or week

    Quote Originally Posted by humdingaling View Post
    Reattached file with pivot table and helper
    FDibbins/humdingaling

    Sorry if I did not explained it well. Anyway, This works! Thanks!

    but with this so much volume of data and still counting, Is it possible to not have a helper? the actual file of the raw data is in separate excel file (should not be edited for some reason) from the formula for counting rain days summary.

  12. #12
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Formula for counting rain days of the year, month, and or week

    you could just take the assumption that old data does not change

    so use the raw to create a summary file once and update the summary file every month with only NEW data

  13. #13
    Forum Contributor
    Join Date
    03-22-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2013
    Posts
    124

    Re: Formula for counting rain days of the year, month, and or week

    Quote Originally Posted by humdingaling View Post
    Reattached file with pivot table and helper
    Hi humdingaling,

    This is counting the raindays correctly but I can't see the reference date to count. how can I choose what year, month, or week to summarize rain days? for example @ K6 for week 1, 2015 rain days. K6=SUMPRODUCT(--(YEAR($A$3:$A$24291)=2015)*($D$3:$D$24291="Y")*(($E$3:$E$24291)=ROW(A1)))

    what is A1? and I cant see the wk 1, 2015 cell reference in the formula

  14. #14
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Formula for counting rain days of the year, month, and or week

    i was just making the formula update with the row

    row(a1) = 1
    row(A2) = 2

    its not necessary and i actually think you should take it out as i have found this sheet run really slow due to the amount of data

  15. #15
    Forum Contributor
    Join Date
    03-22-2016
    Location
    Philippines
    MS-Off Ver
    MS Office 2013
    Posts
    124

    Re: Formula for counting rain days of the year, month, and or week

    Quote Originally Posted by humdingaling View Post
    i was just making the formula update with the row

    row(a1) = 1
    row(A2) = 2

    its not necessary and i actually think you should take it out as i have found this sheet run really slow due to the amount of data
    I get it. I will just change raw(A1) to my reference (wk.1 ,20150) and create a formula that will make "wk.1 ,2015" equate to "1"
    and "2015" at YEAR($A$3:$A$24291)=2015 that will "wk.1,2015" equate to "2015"

    thanks for the immediate help, humdingaling.

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Formula for counting rain days of the year, month, and or week

    SP in that amount of data will run slow

    As hum suggested, you can "value" the formulas that pull put the week nums, and just leave the formulas there for the latest dates

    (thanks for the rep

  17. #17
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Formula for counting rain days of the year, month, and or week

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    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.

+ 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] Calculate Week Range from Week Number, Month and Year?
    By A108A108 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 05-07-2016, 03:11 PM
  2. This time last week, last month, last year.
    By sungen99 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-08-2015, 02:13 PM
  3. find time left in month.days unit between two dates(in YEAR.MONTH.DAY)
    By xcfeng95 in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 02-21-2014, 12:55 PM
  4. Return value of the last week of the month based on the year and month
    By stevekho2 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-14-2013, 11:04 AM
  5. Days since last rain
    By ejaeschk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-20-2013, 10:57 AM
  6. [SOLVED] Need a formula that picks up the date for Monday for each week from a given month and year
    By davisfs2007 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-11-2013, 02:21 PM
  7. Adding sort by week, month and year to existing formula
    By Throtmorton P. in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-22-2012, 06:41 AM

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