Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default turning "1 day, 1 hour, 30 minutes" into 1530 minutes

I have a column of cells that contain day, hour, minute which is used to
determine how long it takes for a technician to accomplish a task in the
following format:

1 day, 1 hour, 30 minutes
1 day, 1 hour, 42 minutes
1 day, 1 hour, 52 minutes

but also includes cells that look like this:
1 hour
1 hour, 11 minutes
1 day, 57 minutes

What I would like to do is convert these cells into minutes only.
Maybe set a variable that sets
" day, " or " days, " to 1440
" hour, " or " hours, " to 60
"minute" or "minutes" to 1

and then multiply and put the result in the adjacent cell?

Maybe I'm going about this the entirely wrong way, but any advice would be
appreciated. Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default turning "1 day, 1 hour, 30 minutes" into 1530 minutes

Try this:

Sub Tester()
Dim arrQuant(1 To 3) As Long
Dim arrUnit(1 To 3) As String
arrUnit(1) = "day"
arrUnit(2) = "hour"
arrUnit(3) = "minute"
LastRow = Cells(65536, 1).End(xlUp).Row
For i = 1 To LastRow
sTest = Cells(i, 1)
For j = 1 To 3
UnitPos = InStr(1, sTest, arrUnit(j))
If UnitPos < 0 Then
arrQuant(j) = Val(sTest)
CommaPos = InStr(1, sTest, ",")
If CommaPos < 0 Then
sTest = Mid(sTest, CommaPos + 2)
Else: Exit For
End If
End If
Next j
Cells(i, 2) = 24 * 60 * arrQuant(1) _
+ 60 * arrQuant(2) + arrQuant(3)
sTest = ""
Erase arrQuant
Next i
End Sub

HTH,
Shockley


"Joe Murphy" wrote in message
...
I have a column of cells that contain day, hour, minute which is used to
determine how long it takes for a technician to accomplish a task in the
following format:

1 day, 1 hour, 30 minutes
1 day, 1 hour, 42 minutes
1 day, 1 hour, 52 minutes

but also includes cells that look like this:
1 hour
1 hour, 11 minutes
1 day, 57 minutes

What I would like to do is convert these cells into minutes only.
Maybe set a variable that sets
" day, " or " days, " to 1440
" hour, " or " hours, " to 60
"minute" or "minutes" to 1

and then multiply and put the result in the adjacent cell?

Maybe I'm going about this the entirely wrong way, but any advice would be
appreciated. Thanks.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to specific "minutes:seconds" in cell format man Excel Discussion (Misc queries) 2 September 1st 09 05:31 AM
hour minutes to minutes oldLearner57 Excel Discussion (Misc queries) 2 July 24th 07 01:32 AM
"60 Minutes" Excel MyVeryOwnSelf Excel Discussion (Misc queries) 0 April 1st 06 01:45 AM
With 30 minutes "work" millionaire?!? With 30 minutes \work\ millionaire?!? Charts and Charting in Excel 0 December 10th 05 02:41 AM
With 30 minutes "work" millionaire?!? With 30 minutes \work\ millionaire?!? Charts and Charting in Excel 0 December 10th 05 02:41 AM


All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"