Avatar of Michael
Michael
 asked on

Excel VBA extracting hours, minutes and seconds from a Duration time stamp

I wish to extract the hours, minutes and seconds from a duration time stamp for example: 114:35:10

If such a duration is inserted into a cell, excel places a date stamp prior to it.

When I attempt to use:

Hour(string) or format(string,  “[h]:mm:ss”) the result is incorrect.
I also want to be able to extract the mm and ss values.

Can an expert please help.
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
aikimark

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Subodh Tiwari (Neeraj)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Norie

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
aikimark

@Michael

How is the duration cell formatted?
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Michael

ASKER
Thanks for everyone responses. You have assisted me in either answering my question through the use of VBA or cell formulas. As for Aikimark comment: as soon as I input a duration the cell is formatted as “[h]:mm:ss”. Thanks for everyone’s input.
Subodh Tiwari (Neeraj)

You're welcome Michael!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
aikimark

What is the unit(s) of your time duration that you enter?