+ Reply to Thread
Results 1 to 22 of 22

COUNT hours and days

  1. #1
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    COUNT hours and days

    Pleas see spread-sheet attached.

    There are only 2 columns to look at.

    Column B corresponds to the date found in Column A (which is in chronological order from oldest to newest).

    I want to track every time in column B the value drops beneath ZERO and how long (duration) it takes from the row it dropped beneath ZERO to reach back to ZERO. The two corresponding dates will allow me to gauge the time it takes for every time this occurs.

    Please see spread-sheet for more details.

    Can anyone assist me with a formula? You can show the duration value in column C?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Hopefully that's clear? If not please ask and I will elaborate

  3. #3
    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,926

    Re: COUNT hours and days

    If you have an excel workbook, why upload a csv file?
    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

  4. #4
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Because i had 110,000 rows (over the file size limit). After cutting it down loads I lost enough data for a decent example test sheet so i saved as csv... Is this a problem because I can give you a worksheet if that helps?

  5. #5
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: COUNT hours and days

    Pete UK came up with some formulas if you are familiar with how to use them if not you might be able to shoot him a pm and url link of your post and he most likely will be able to provide you with a solution.

    http://www.excelforum.com/showthread...t=#post4350262
    Thank those who have helped you by clicking the Star * below their name and please mark your post [SOLVED] if it has been answered satisfactorily.

  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,926

    Re: COUNT hours and days

    we just need to see enough data to show what you are working with, and some samples of what you want

  7. #7
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Quote Originally Posted by FDibbins View Post
    we just need to see enough data to show what you are working with, and some samples of what you want
    Attached
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Quote Originally Posted by Jack7774 View Post
    Pete UK came up with some formulas if you are familiar with how to use them if not you might be able to shoot him a pm and url link of your post and he most likely will be able to provide you with a solution.

    http://www.excelforum.com/showthread...t=#post4350262
    Thanks Jack although I am struggling to wrap my head around it. I've never been the sharpest in excel although i use it a lot for repetitive things Just a very slow learner!

  9. #9
    Forum Contributor Jack7774's Avatar
    Join Date
    08-31-2012
    Location
    Georgia, US
    MS-Off Ver
    Excel 2010
    Posts
    576

    Re: COUNT hours and days

    Quote Originally Posted by domgilberto View Post
    Thanks Jack although I am struggling to wrap my head around it. I've never been the sharpest in excel although i use it a lot for repetitive things Just a very slow learner!
    Your slow if you say your slow and will stay slow as long as you claim your slow. So your not slow but extremely fast and this comes natural to you! haha anyways um ya so I'm trying to figure it out myself at the moment. It will take a bit of experimenting myself.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: COUNT hours and days

    There is a problem that I see with the data. There are times that have both 0 and below 0 values therefore a time can't be calculated as the times would be identical and the result would be 0. Row 315 is an example.
    A
    B
    314
    02/12/2010 18:00
    0.00%
    315
    02/12/2010 19:00
    -0.01%
    316
    02/12/2010 19:00
    0.00%
    317
    02/12/2010 19:00
    0.00%


    Row 315 drops below 0 and the time to recover is identical to the time that the drop occurred.

    Here is another example
    A
    B
    358
    02/15/2010 08:00
    0.00%
    359
    02/15/2010 08:00
    -0.04%
    360
    02/15/2010 08:00
    -0.03%
    361
    02/15/2010 08:00
    -0.04%
    362
    02/15/2010 08:00
    -0.04%
    363
    02/15/2010 08:00
    -0.03%
    364
    02/15/2010 08:00
    0.00%
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  11. #11
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Ah yes I forgot to mention this. Is there a way to ignore situations like this?

    What are your thoughts? The data is in the correct chronological order but in those instances you've highlighted the difference in time is either in seconds or more likely milliseconds apart (so not worth measuring). I am more interested in anything that has an hour duration or longer?

    Any work around on this or is this a nightmare?

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: COUNT hours and days

    I found some another issue. I kept getting the row in which the draw down occurred as being row 21 instead of row 23. I increased the number of decimal places to six and the value of B21 was -0.000018 At any rate the formula that I used to find the difference in days hours:minutes between the draw down and recovery is:
    Please Login or Register  to view this content.
    Edit: here a copy of your file with the formula applied to the values only of the file from post #7: (Duration) draw-down recovery time cdf example.xlsx
    Let me know if you have any questions.
    Last edited by JeteMc; 03-30-2016 at 06:01 PM. Reason: Added file
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: COUNT hours and days

    Some of your indicated % values are very small negative values and not 0. 0 is indicated because of the number of decimal places displayed.

    Enter this in C2 and fill down. It will include the very small values that are negative but indicate 0.00% as they are not really 0.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Enter this in D2 and fill down. Format as [h]:mm to give the hours of duration
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    To have the time as days and hours format as dd h:mm. The result will look like this 02 14:30 for 2 days 14 hours 30 minutes.
    Attached Files Attached Files
    Last edited by newdoverman; 03-30-2016 at 05:58 PM.

  14. #14
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: COUNT hours and days

    To easily hide 0 values use Conditional Formatting. Select column D and go to Conditional Formatting, New Rule, Use Formula..., and enter =D1=0 then format the font as white.

    This could be valuable if you ever need to see the 0 values. All that you would have to do is to select the D column and format the font in a colour other than white.

  15. #15
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    I've yet to look and study both of your responses but thank you for responding and helping. I will post again to give you my feedback to your input.

    In the meantime I have attached below a spread-sheet that consolidates my data into chronological days / hours (so there is no duplicate times). Hopefully this should be easier to apply the correct formula to? The questions is; how do I fix up the dates from the pivot table into a readable excel date format? I have no idea why the pivot table does that!?
    Attached Files Attached Files

  16. #16
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Quote Originally Posted by JeteMc View Post
    I found some another issue. I kept getting the row in which the draw down occurred as being row 21 instead of row 23. I increased the number of decimal places to six and the value of B21 was -0.000018 At any rate the formula that I used to find the difference in days hours:minutes between the draw down and recovery is:
    Please Login or Register  to view this content.
    Edit: here a copy of your file with the formula applied to the values only of the file from post #7: Attachment 453614
    Let me know if you have any questions.
    I think you've got it here. I assume the results are stacked in logical order as it is just looking at the entire array? If this is right, how could you correspond these results with what the lowest draw-down was in the give result (say in column D)?

  17. #17
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Ok so newdoverman your formula works perfectly and I also have the draw-down result in there now too (in column D).

    Does anyone know why excel wont show duration (DD:HH:MM) on the scatter graph? See here: http://screencast.com/t/h5n1MF8GUGWe

  18. #18
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: COUNT hours and days

    The file that you created and uploaded in msg #15 is not useable as the dates and times are not in any way an Excel time format. The upload in msg # 17 is a picture and can't be worked with.

  19. #19
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Quote Originally Posted by newdoverman View Post
    The file that you created and uploaded in msg #15 is not useable as the dates and times are not in any way an Excel time format. The upload in msg # 17 is a picture and can't be worked with.
    Attached
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Any advice? I can't seem to find out much information about using a duration variable (DD:HH:MM) on a scatter graph? Any ideas?

  21. #21
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: COUNT hours and days

    As promised.
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Re: COUNT hours and days

    Quote Originally Posted by newdoverman View Post
    As promised.
    Nailed it as usual! Thanks mate!

+ 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. Replies: 2
    Last Post: 07-08-2014, 07:00 PM
  2. [SOLVED] Function or macro to convert string with weeks, days, hours, minutes to Hours
    By kknb0800 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2012, 11:35 AM
  3. Replies: 3
    Last Post: 08-23-2011, 01:09 PM
  4. Replies: 0
    Last Post: 04-07-2011, 01:46 AM
  5. Count hours between 2 days
    By noyengrayz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-24-2010, 07:04 AM
  6. Replies: 6
    Last Post: 03-25-2010, 07:50 AM
  7. Converting hours to 8 hour days, 31 day limit? Formula blows up at 256 hours..
    By krfarmer in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-25-2010, 05:21 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