+ Reply to Thread
Results 1 to 5 of 5

Excel formula to calculate the average flow per hour

  1. #1
    Registered User
    Join Date
    03-22-2012
    Location
    pune
    MS-Off Ver
    Excel 2007
    Posts
    14

    Excel formula to calculate the average flow per hour

    I have attached the excel sheet with sample data. I need more generalised formula for flows per hour and flows per day since the existing formula in the sheet has many drawbacks:
    1. At the end it shows a negative value and cant avoid it (since the number of rows is not fixed, I get this data from database by using a macro)
    2. If the flow at any particular time( in this case say 19032012 00:36 is missing) fails then the whole formula for flow per hour goes wrong

    Can I have a formula which calculates flows per hour depending on the time ( in this case 00:06 to 00:51)



    Thanks in advance
    Attached Files Attached Files
    Last edited by PhAnT0M; 03-26-2012 at 11:42 AM.

  2. #2
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Excel formula help

    Use this for column E:
    =DATE(MID(A2,5,4),MID(A2,3,2),LEFT(A2,2))+TIME(MID(A2,10,2),RIGHT(A2,2),0)

    And use this for Column G:
    =SUMPRODUCT(((DATE(MID(A2:A31,5,4),MID(A2:A31,3,2),LEFT(A2:A31,2))+TIME(MID(A2:A31,10,2),RIGHT(A2:A31,2),0))<DATE(MID(A2:A31,5,4),MID(A2:A31,3,2),LEFT(A2:A31,2))+TIME(1,RIGHT(0),0))*(B2:B31))

    For the TIME formula (bolded), the 1 represents the hour of the day. You could also replace the 1 with ROW()-1, which will adjust itself to 1 in the second row and then count up as you drag it down.

  3. #3
    Forum Contributor
    Join Date
    08-29-2011
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    171

    Re: Excel formula help

    Sorry, I meant the formula for Column G to be:
    =SUMPRODUCT(((DATE(MID(A2:A31,5,4),MID(A2:A31,3,2),LEFT(A2:A31,2))+TIME(MID(A2:A31,10,2),RIGHT(A2:A31,2),0))<DATE(MID(A2:A31,5,4),MID(A2:A31,3,2),LEFT(A2:A31,2))+TIME(1,0,0))*(B2:B31))

    Same comment applies from above though

  4. #4
    Registered User
    Join Date
    03-22-2012
    Location
    pune
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel formula help

    The above formula is not working and giving me error

  5. #5
    Registered User
    Join Date
    03-22-2012
    Location
    pune
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Excel formula help

    This is not giving me flows per hour after dragging the formula, but the entire flow till the specified cell

+ 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