ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Numerical values only (https://www.excelbanter.com/excel-discussion-misc-queries/77832-numerical-values-only.html)

saziz

Numerical values only
 

Hi,
How can I transfer from one cell to other only numerical values.
Like in one cell I have "sun rise time 06:15" I want in adjecent cell
only 06:15
Pleae help.
thanks
Saziz


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=523269


Pete_UK

Numerical values only
 
If your data is always like that, i.e. time information occupying the
last 5 characters of the string, then you can do this, assuming the
data is in cell A1:

=VALUE(RIGHT(A1,5)&":00")

and format the cell with the formula in as hh:mm.

Hope this helps.

Pete


Niek Otten

Numerical values only
 
You could use this User defined Function.

If you're new to VBA, read this first:

http://www.mvps.org/dmcritchie/excel/getstarted.htm


The function:

' ================================================== ===========================

Function StripTxt(a As String) As String

' Strips all non-numeric characters from a string, but leaves colons

' Returns a string, not a number!

Dim i As Long

Dim b As String

For i = 1 To Len(a)

b = Mid$(a, i, 1)

If ((Asc(b) 47 And Asc(b) < 58) Or b = ":") Then StripTxt = StripTxt + b

Next i

End Function

' ================================================== ===========================


--
Kind regards,

Niek Otten




"saziz" wrote in message
...

Hi,
How can I transfer from one cell to other only numerical values.
Like in one cell I have "sun rise time 06:15" I want in adjecent cell
only 06:15
Pleae help.
thanks
Saziz


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=523269




saziz

Numerical values only
 

Thank you Niek Otten and Pete_UK both the suggestions worked perfectly.
Saziz


--
saziz
------------------------------------------------------------------------
saziz's Profile: http://www.excelforum.com/member.php...fo&userid=6350
View this thread: http://www.excelforum.com/showthread...hreadid=523269


Pete_UK

Numerical values only
 
Thanks for feeding back.

Pete



All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com