+ Reply to Thread
Results 1 to 6 of 6

UDF for converting seconds

  1. #1
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    369

    UDF for converting seconds

    hi all,

    I wrote this function to convert cells containing Hrs, Minutes and second into just seconds
    Please Login or Register  to view this content.
    but i also need one to do the opposite,

    i started with
    Please Login or Register  to view this content.
    but want i need is for the output to say (as an example) 4002 seconds as "1 hr(s) 6 minutes(s) and 42 seconds"

    any help please

    thanks, wayne

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: UDF for converting seconds

    Hours

    =INT(F4/3600)

    Minutes

    INT((F4-(INT(F4/3600)*3600))/60)

    Seconds

    (F4-(INT(F4/3600)*3600))-(INT((F4-(INT(F4/3600)*3600))/60)

    Where f4 is your value, i did it in the worksheet for speed.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,444

    Re: UDF for converting seconds

    Please Login or Register  to view this content.
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: UDF for converting seconds

    Very easy:

    Please Login or Register  to view this content.
    Gary's Student

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: UDF for converting seconds

    Nice idea Jako, i thought that would have errored when over 60, nice touch, i'll use that :o)

  6. #6
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    369

    Re: UDF for converting seconds

    ty Jakobshavn , that was exactly what i needed. i assume my approach on calculating things was wrong. i just need to find out now how to save this function so its applicable every time i open excel irrespective what file it is.

+ 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: 4
    Last Post: 01-18-2010, 04:29 AM
  2. Converting time from seconds
    By ssmith911 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-31-2008, 11:43 AM
  3. Converting M:SS to Seconds
    By J.H. in forum Excel General
    Replies: 4
    Last Post: 08-30-2007, 09:44 AM
  4. [SOLVED] converting seconds in hh:mm:ss
    By Xavie in forum Excel General
    Replies: 4
    Last Post: 04-06-2006, 11:20 AM
  5. [SOLVED] Converting Julian Seconds with a macro to replace old seconds data
    By Keldair in forum Excel General
    Replies: 2
    Last Post: 02-17-2006, 08:15 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