+ Reply to Thread
Results 1 to 9 of 9

Having problems with a function that counts seconds in a time sequence

  1. #1
    Registered User
    Join Date
    06-19-2005
    Posts
    49

    Having problems with a function that counts seconds in a time sequence

    Can't seem to overcome a barrier in counting seconds for time sequences that will never go over 10 datapoints. Have a user defined function in my spreadsheet which gives me locations of my semi-colons >>> https://www.dropbox.com/s/n4q4e8jfbt5hb4e/example.xlsm

    Sample time sequences (mm:ss) with semi-colon separating time sequences:

    #1 24:23; 24:26-24:27; 24:37-24:39; 24:17-24:18; 10:39; 24:40-24:41; 24:28 >>> Calculates 12 seconds, CORRECT!

    #2 13:19-13:23; 13:14-13:16 >>>>> Calculates 6 seconds, WRONG, s/b 8 seconds

    #3 17:22-17:37 >>>>>> Calculates 16 seconds, CORRECT!

    #4 12:12 >>>>>>> Calculates 1 second, CORRECT!

    #5 12:25; 12:28; 12:30 >>>>>>>> Calculates 3 seconds, CORRECT!

    #6 17:22-17:37; 17:40 >>>>>> Calculates 17 seconds, CORRECT!

    My problem is, when I have more than a one second time sequence as my last time sequence; when there are more than one time sequences, it evaluates it as one second. Can anyone help me?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,231

    Re: Having problems with a function that counts seconds in a time sequence

    Upload the workbook to the forum. Some people, me included, won't download from external links.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-19-2005
    Posts
    49

    Re: Having problems with a function that counts seconds in a time sequence

    Ok, thank you.
    Attached Files Attached Files

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Having problems with a function that counts seconds in a time sequence

    Question: how did you come up with 8?

    #2 13:19-13:23; 13:14-13:16 >>>>> Calculates 6 seconds, WRONG, s/b 8 seconds
    When 13:23-13:19=0:04
    13:16-13:14=0:02
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    06-19-2005
    Posts
    49

    Re: Having problems with a function that counts seconds in a time sequence

    because it is inclusive . . . 13:19, 13:20, 13:21, 13:22, 13:23, 13:14, 13:15, 13:16 = 8

    dash is not a minus sign, it is a continuation sign . . . i want to count the seconds represented

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,231

    Re: Having problems with a function that counts seconds in a time sequence

    Maybe this function instead:

    Please Login or Register  to view this content.


    Regards, TMS

  7. #7
    Registered User
    Join Date
    06-19-2005
    Posts
    49

    Re: Having problems with a function that counts seconds in a time sequence

    Thank you very much! Works awesome!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,231

    Re: Having problems with a function that counts seconds in a time sequence

    You're welcome. Thanks for the rep.


    Bit shorter, maybe?



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,231

    Re: Having problems with a function that counts seconds in a time sequence

    Note that the function is not limited to 10 data points.


    And this variation copes better with "bad" data, that is, it doesn't generate #VALUE! errors if the data is missing the colon or has unexpected characters.

    It also has the option to not be inclusive, should that be a requirement ... but mainly to address AlKey's question in post #4.

    Please Login or Register  to view this content.

+ 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. Adding time values for no sequence cells with an IF function
    By Khaldon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2011, 04:00 AM
  2. Filtering time from 1 seconds into 10 seconds
    By Deane in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 05-30-2010, 09:48 PM
  3. Problems using RTD (real time data) function from VBA
    By Valeria80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-14-2009, 04:00 AM
  4. Convert "Time Interval" in "hours : minutes : seconds" to seconds
    By deano27 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-28-2008, 09:07 AM
  5. Replies: 7
    Last Post: 05-08-2005, 04:06 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