Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extracting first two digits of a time entry!!


HI friends,
Could anyone tell me how to extract first two digits of a "Time
value"

For example in cell B10 the content is 12:00 ie..(Time)
I am not able to extract "12" ie the first two digits of that time.

I am getting 0.5013 when taken as text.


Regards,
TIA


Roshin


--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile: http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=569321

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Extracting first two digits of a time entry!!

roshinpp_77 wrote:

HI friends,
Could anyone tell me how to extract first two digits of a "Time
value"

For example in cell B10 the content is 12:00 ie..(Time)
I am not able to extract "12" ie the first two digits of that time.

I am getting 0.5013 when taken as text.


Regards,
TIA


Roshin


Hello,
use this left(range("B10").text,2)

Mike,Luxembourg
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Extracting first two digits of a time entry!!

Hi Roshin,

Try this
=LEFT(TEXT(B10,"hh:mm"),2)

--
Thanks
Xcelion



"roshinpp_77" wrote:


HI friends,
Could anyone tell me how to extract first two digits of a "Time
value"

For example in cell B10 the content is 12:00 ie..(Time)
I am not able to extract "12" ie the first two digits of that time.

I am getting 0.5013 when taken as text.


Regards,
TIA


Roshin


--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile: http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=569321


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Extracting first two digits of a time entry!!

Depending what you actually want returned, a string or a number.
Assuming the value is a double formatted as a time:
Public Function GetHourOnly(argRange As Range) As Integer
GetHourOnly = Int(argRange.Value * 24)
End Function
Or
Public Function GetHourOnly(argRange As Range) As String
GetHourOnly = Left(argRange.Text, 2)
End Function

NickHK

"roshinpp_77"
wrote in message
...

HI friends,
Could anyone tell me how to extract first two digits of a "Time
value"

For example in cell B10 the content is 12:00 ie..(Time)
I am not able to extract "12" ie the first two digits of that time.

I am getting 0.5013 when taken as text.


Regards,
TIA


Roshin


--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile:

http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=569321



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Extracting first two digits of a time entry!!

You can extract the hour, minute or second:

With ActiveSheet.range("B10")
MsgBox Hour(.Value) & vbLf & _
Minute(.Value) & vbLf & _
Second(.Value)
End With



roshinpp_77 wrote:

HI friends,
Could anyone tell me how to extract first two digits of a "Time
value"

For example in cell B10 the content is 12:00 ie..(Time)
I am not able to extract "12" ie the first two digits of that time.

I am getting 0.5013 when taken as text.

Regards,
TIA

Roshin

--
roshinpp_77
------------------------------------------------------------------------
roshinpp_77's Profile: http://www.excelforum.com/member.php...o&userid=34924
View this thread: http://www.excelforum.com/showthread...hreadid=569321


--

Dave Peterson
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
extracting digits to the right of a decima point Steve Excel Worksheet Functions 2 August 2nd 06 10:17 PM
extracting digits to the right of a decima point David Billigmeier Excel Worksheet Functions 0 August 2nd 06 10:05 PM
Extracting 1st 3-digits of postal code that begin with 0 Pcakes Excel Worksheet Functions 8 June 22nd 06 11:35 PM
Extracting text from a cell entry morchard Excel Discussion (Misc queries) 2 July 6th 05 03:53 PM
extracting numbers with no more than 8-digits using advanced filtering Gauthier Excel Worksheet Functions 10 October 29th 04 10:06 PM


All times are GMT +1. The time now is 01: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"