Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default How to convert this text number and fraction to 1 figure using mac

Hi all,

I have this text in a number of cells typed in as e.g. ".09 1/4" which in
numeric terms is 0.0925.

My questions is, can someone please help me think of a simple macro to
automatically covert the cell to a numeric.

Many thanks in advance.
Ray
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default How to convert this text number and fraction to 1 figure using mac

One way:

Dim rCell As Range
Dim n As Long
For Each rCell In Selection.Cells
With rCell
n = InStr(.Text, " ")
If n 0 Then
On Error Resume Next
.Value = CDbl(Left(.Text, n - 1) & _
Mid(Evaluate(Mid(.Text, n + 1)), 3))
On Error GoTo 0
End If
End With
Next rCell


In article ,
swiftcode wrote:

Hi all,

I have this text in a number of cells typed in as e.g. ".09 1/4" which in
numeric terms is 0.0925.

My questions is, can someone please help me think of a simple macro to
automatically covert the cell to a numeric.

Many thanks in advance.
Ray

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 36
Default How to convert this text number and fraction to 1 figure using

Thanks JE, it works great.

Have a good day ahead.

Rgds
Ray

"JE McGimpsey" wrote:

One way:

Dim rCell As Range
Dim n As Long
For Each rCell In Selection.Cells
With rCell
n = InStr(.Text, " ")
If n 0 Then
On Error Resume Next
.Value = CDbl(Left(.Text, n - 1) & _
Mid(Evaluate(Mid(.Text, n + 1)), 3))
On Error GoTo 0
End If
End With
Next rCell


In article ,
swiftcode wrote:

Hi all,

I have this text in a number of cells typed in as e.g. ".09 1/4" which in
numeric terms is 0.0925.

My questions is, can someone please help me think of a simple macro to
automatically covert the cell to a numeric.

Many thanks in advance.
Ray


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,420
Default How to convert this text number and fraction to 1 figure using mac

Dim posSpace As Long
Dim posSlash As Long
Dim numChars As Long
Dim tmp As Variant

With ActiveCell

numChars = Len(.Text)
posSpace = InStr(.Text, " ")
posSlash = InStr(.Text, "/")
tmp = Mid(.Text, posSlash - 1, posSlash - posSpace - 1) / Mid(.Text,
numChars, posSlash - 1)
tmp = Left$(.Text, posSpace - 1) & tmp * 100
.Value = Val(tmp)
End With


--
__________________________________
HTH

Bob

"swiftcode" wrote in message
...
Hi all,

I have this text in a number of cells typed in as e.g. ".09 1/4" which in
numeric terms is 0.0925.

My questions is, can someone please help me think of a simple macro to
automatically covert the cell to a numeric.

Many thanks in advance.
Ray



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default How to convert this text number and fraction to 1 figure usingmac

provided yr data always follows that same pattern you might also try a
formula:

=LEFT(A1,FIND(" ",A1)-1)+(LEFT(RIGHT(A1,FIND(" ",A1)-1),1)/RIGHT(RIGHT
(A1,FIND(" ",A1)-1),1))/100



On 14 Sty, 08:33, swiftcode
wrote:
Hi all,

I have this text in a number of cells typed in as e.g. ".09 1/4" which in
numeric terms is 0.0925.

My questions is, can someone please help me think of a simple macro to
automatically covert the cell to a numeric.

Many thanks in advance.
Ray


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
i need formula which convert figure in to text Zafar Excel Worksheet Functions 1 August 22nd 07 01:34 PM
i need formula which convert figure in to text Zafar Excel Worksheet Functions 1 August 22nd 07 12:44 PM
Take fraction out of the figure 0-0 Wai Wai ^-^ Excel Worksheet Functions 3 April 23rd 06 09:03 AM
how to convert numerical figure into text ckchuah Excel Worksheet Functions 1 August 23rd 05 02:40 PM
How do I change a text fraction. eg 1 1/2 into a decimal number, . antac Excel Worksheet Functions 1 February 28th 05 05:02 PM


All times are GMT +1. The time now is 12:03 PM.

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"