Does any know how I can convert 29.18:20:18 to total minutes?
Does any know how I can convert 29.18:20:18 to total minutes?
Last edited by oldchippy; 10-23-2008 at 04:09 PM.
Hi Nunzio - you'll have to parse the string like this:
Depending on how you want to use it, you might want to convert it to a function for use in the sheet.![]()
Private Sub DaysHoursMinsSecs() Dim lngDays As Long Dim lngHours As Long Dim lngMins As Long Dim lngSecs As Long Dim strDaySeparator As String Dim strTimeSeparator As String Dim strData As String Dim lngMinutes As Long strData = Range("A1").Text strDaySeparator = "." strTimeSeparator = ":" lngDays = Left(strData, InStr(strData, strDaySeparator) - 1) strData = Right(strData, Len(strData) - InStr(strData, strDaySeparator)) lngHours = Left(strData, InStr(strData, strTimeSeparator) - 1) strData = Right(strData, Len(strData) - InStr(strData, strTimeSeparator)) lngMins = Left(strData, InStr(strData, strTimeSeparator) - 1) strData = Right(strData, Len(strData) - InStr(strData, strTimeSeparator)) lngSecs = CInt(strData) lngMinutes = (lngDays * 24 * 60) + (lngHours * 60) + (lngMins) + (lngSecs / 60) End Sub
Hope that helps. MM.
MM
I am not sure how to
End SubDepending on how you want to use it, you might want to convert it to a function for use in the sheet.
Can anyone make this easier, I want to convert B1 through B8 from the days, hours, minutes and seconds to just the number of total minutes.
Thanks
Do you need VBA or will a formula suffice?
Assuming B1 is a text string then try this formula in C1
=(LEFT(A1,FIND(".",B1)-1)+RIGHT(B1,8))*1440
A formula will work but I have to be able to calculate each cell (B1-B12) separately, and each cell could be a different variation of time, they could be any variation of days, hours, minutes, and seconds.
Machine Down
Assembler 07:43:45
Bottle Sorter 13:57:17
Cap Sorter 04:02:05
Cartoner 1.09:45:48
Case Packer 15:38:40
Depucker 12:45:12
Filler 19:49:23
Line 00:00:00
Pucker 10:29:08
Sheath Sorter 01:16:12
Tray Packer 11:57:48
Wick Sorter 07:19:02
Hi,
Try this
=IF(LEN(B2)=8,RIGHT(B2,8)*1440,(LEFT(B2,FIND(".",B2)-1)+RIGHT(B2,8))*1440)
oldchippy
-------------
![]()
![]()
Blessed are those who can give without remembering and take without forgetting
If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.
Click here >>> Top Excel links for beginners to Experts
Forum Rules >>>Please don't forget to read these
old chippy thanks a million.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks