#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 172
Default Truncating cells

I have a column of cells formatted as text containing a number and text i.e:
123.123 text text text
I need some way of truncating the cell to only show the number for
calculation purposes. Any Ideas?

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Truncating cells

One way:

Choose Data/Text to Columns... Choose Delimited with a space. in the
Third pane of the Text to Columns dialog, select the columns after the
first and choose "Do not import column (skip)".

(If all numbers are the same length, choose Fixed instead, and click
between the number and the first text, then proceed as above).

In article ,
Simon wrote:

I have a column of cells formatted as text containing a number and text i.e:
123.123 text text text
I need some way of truncating the cell to only show the number for
calculation purposes. Any Ideas?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default Truncating cells

Let's assume your text is in A1 and let's also assume that the number is
always followed by a space.

=VALUE(LEFT(A1,SEARCH(" ",A1)-1))
--
HTH,
Barb Reinhardt



"Simon" wrote:

I have a column of cells formatted as text containing a number and text i.e:
123.123 text text text
I need some way of truncating the cell to only show the number for
calculation purposes. Any Ideas?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Truncating cells

For numbers beginning, middle or end regardless of spaces:-

Option Explicit
Sub extractnumbers()
Dim RegExp As Object, Collection As Object, RegMatch As Object
Dim Myrange As Range, C As Range, Outstring As String
Set RegExp = CreateObject("vbscript.RegExp")
With RegExp
.Global = True
.Pattern = "d+|\d+.\d+"
End With
Set Myrange = ActiveSheet.Range("a1:a100") 'change to suit
For Each C In Myrange
Outstring = ""
Set Collection = RegExp.Execute(C.Value)
For Each RegMatch In Collection
Outstring = Outstring & RegMatch
Next
C.Offset(0, 1) = Outstring
Next

Set Collection = Nothing
Set RegExp = Nothing
Set Myrange = Nothing

End Sub


Mike

"Simon" wrote:

I have a column of cells formatted as text containing a number and text i.e:
123.123 text text text
I need some way of truncating the cell to only show the number for
calculation purposes. Any Ideas?

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Truncating cells

=REPLACE(A1,FIND(" ",A1),255,"")+0


"Simon" wrote:

I have a column of cells formatted as text containing a number and text i.e:
123.123 text text text
I need some way of truncating the cell to only show the number for
calculation purposes. Any Ideas?

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
numbers truncating Sue Excel Discussion (Misc queries) 3 January 25th 07 12:52 PM
truncating series Michael Charts and Charting in Excel 0 May 31st 06 11:41 AM
truncating text scott_cairns Excel Discussion (Misc queries) 7 May 30th 06 01:51 PM
Truncating a columns worth of cells not just a single cell. rebates Excel Worksheet Functions 1 July 26th 05 01:15 AM
Reduce # of pages & help truncating cells CDAK Excel Discussion (Misc queries) 1 June 16th 05 10:06 PM


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