Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Advanced Text to Columns??

I wonder if anyone can help me (again!) I have an excel sheet which has 500+
rows of data which has come from a database - one of the colums is a size
column and has data like the bit below:

3.803 X 3.327 X 0.391
6.519 X 6.053 X 0.27
003.745X 002.080X 009.850
003.745X 002.080X 009.850
002.790X 001.580X 006.400
002.860X 001.580X 009.470
3.05 / 2.075 / 2.05
2.68 X 2.0 X 9.53
003.660X 002.230X 004.640

I would like to split this into 3 seperate colunms and thought I had nothing
better to do but use the text to colums comand - however there are so many
different formats that even with the column sorted it is taking me a long
time to sort out!

Is there an easier way to do this??

Many thanks

Wendy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Advanced Text to Columns??

Each of the numbers goes into separate columns.

I would start by selecting the column and doing a few edit|Replaces.

I'd replace all the space characters with |
Then all the X's with |
then all the /'s with |
And all the other separators that I could find with |

Then do data|text to columns
Delimited by / (and treat consecutive delimiters as one)
and finish up.

WendyMc wrote:

I wonder if anyone can help me (again!) I have an excel sheet which has 500+
rows of data which has come from a database - one of the colums is a size
column and has data like the bit below:

3.803 X 3.327 X 0.391
6.519 X 6.053 X 0.27
003.745X 002.080X 009.850
003.745X 002.080X 009.850
002.790X 001.580X 006.400
002.860X 001.580X 009.470
3.05 / 2.075 / 2.05
2.68 X 2.0 X 9.53
003.660X 002.230X 004.640

I would like to split this into 3 seperate colunms and thought I had nothing
better to do but use the text to colums comand - however there are so many
different formats that even with the column sorted it is taking me a long
time to sort out!

Is there an easier way to do this??

Many thanks

Wendy


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Advanced Text to Columns??

Dave, many thanks for taking the time to reply to my posting, I have used the
Macro idea which worked a treat.

Thanks again

Wendy

"Dave Peterson" wrote:

Each of the numbers goes into separate columns.

I would start by selecting the column and doing a few edit|Replaces.

I'd replace all the space characters with |
Then all the X's with |
then all the /'s with |
And all the other separators that I could find with |

Then do data|text to columns
Delimited by / (and treat consecutive delimiters as one)
and finish up.

WendyMc wrote:

I wonder if anyone can help me (again!) I have an excel sheet which has 500+
rows of data which has come from a database - one of the colums is a size
column and has data like the bit below:

3.803 X 3.327 X 0.391
6.519 X 6.053 X 0.27
003.745X 002.080X 009.850
003.745X 002.080X 009.850
002.790X 001.580X 006.400
002.860X 001.580X 009.470
3.05 / 2.075 / 2.05
2.68 X 2.0 X 9.53
003.660X 002.230X 004.640

I would like to split this into 3 seperate colunms and thought I had nothing
better to do but use the text to colums comand - however there are so many
different formats that even with the column sorted it is taking me a long
time to sort out!

Is there an easier way to do this??

Many thanks

Wendy


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Advanced Text to Columns??

On Fri, 23 May 2008 03:07:01 -0700, WendyMc
wrote:

I wonder if anyone can help me (again!) I have an excel sheet which has 500+
rows of data which has come from a database - one of the colums is a size
column and has data like the bit below:

3.803 X 3.327 X 0.391
6.519 X 6.053 X 0.27
003.745X 002.080X 009.850
003.745X 002.080X 009.850
002.790X 001.580X 006.400
002.860X 001.580X 009.470
3.05 / 2.075 / 2.05
2.68 X 2.0 X 9.53
003.660X 002.230X 004.640

I would like to split this into 3 seperate colunms and thought I had nothing
better to do but use the text to colums comand - however there are so many
different formats that even with the column sorted it is taking me a long
time to sort out!

Is there an easier way to do this??

Many thanks

Wendy


Here is a macro that will parse out the numbers into separate columns. Please
look at it closely as there are two commented lines indicating whether the
numbers will be returned in "text" format, or in a numeric format. You did not
specify which you wanted.

Delete the line you don't want.

Numbers in text format will retain leading and trailing zeros, but may be more
difficult to use in other functions.

To enter this, <alt-F11 opens the VBEditor. Ensure your project is
highlighted in the Project explorer window, then Insert/Module and paste the
code below into the window that opens.

To use the macro, select the range you wish to split; then <alt-F8 opens the
Macro Dialog box. Select the Macro and <run.

==========================================
Option Explicit
Sub SplitMeasurements()
Dim re As Object, m As Object, mc As Object
Dim c As Range
Dim i As Long
Set re = CreateObject("vbscript.regexp")
re.Pattern = "\d*\.?\d+"
re.Global = True

For Each c In Selection
If re.test(c.Text) = True Then
i = 0
Set mc = re.Execute(c.Text)
For Each m In mc
c.Offset(0, i).Value = m 'results in text
c.Offset(0, i).Value = CDbl(m) 'results in numbers
i = i + 1
Next m
End If
Next c
End Sub
==============================
--ron
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Advanced Text to Columns??

I can't thank you enough for this Macro Ron - it worked a treat and just
saved me hours of work - many many thanks :-)

Wendy

"Ron Rosenfeld" wrote:

On Fri, 23 May 2008 03:07:01 -0700, WendyMc
wrote:

I wonder if anyone can help me (again!) I have an excel sheet which has 500+
rows of data which has come from a database - one of the colums is a size
column and has data like the bit below:

3.803 X 3.327 X 0.391
6.519 X 6.053 X 0.27
003.745X 002.080X 009.850
003.745X 002.080X 009.850
002.790X 001.580X 006.400
002.860X 001.580X 009.470
3.05 / 2.075 / 2.05
2.68 X 2.0 X 9.53
003.660X 002.230X 004.640

I would like to split this into 3 seperate colunms and thought I had nothing
better to do but use the text to colums comand - however there are so many
different formats that even with the column sorted it is taking me a long
time to sort out!

Is there an easier way to do this??

Many thanks

Wendy


Here is a macro that will parse out the numbers into separate columns. Please
look at it closely as there are two commented lines indicating whether the
numbers will be returned in "text" format, or in a numeric format. You did not
specify which you wanted.

Delete the line you don't want.

Numbers in text format will retain leading and trailing zeros, but may be more
difficult to use in other functions.

To enter this, <alt-F11 opens the VBEditor. Ensure your project is
highlighted in the Project explorer window, then Insert/Module and paste the
code below into the window that opens.

To use the macro, select the range you wish to split; then <alt-F8 opens the
Macro Dialog box. Select the Macro and <run.

==========================================
Option Explicit
Sub SplitMeasurements()
Dim re As Object, m As Object, mc As Object
Dim c As Range
Dim i As Long
Set re = CreateObject("vbscript.regexp")
re.Pattern = "\d*\.?\d+"
re.Global = True

For Each c In Selection
If re.test(c.Text) = True Then
i = 0
Set mc = re.Execute(c.Text)
For Each m In mc
c.Offset(0, i).Value = m 'results in text
c.Offset(0, i).Value = CDbl(m) 'results in numbers
i = i + 1
Next m
End If
Next c
End Sub
==============================
--ron



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,651
Default Advanced Text to Columns??

On Fri, 23 May 2008 06:22:03 -0700, WendyMc
wrote:

I can't thank you enough for this Macro Ron - it worked a treat and just
saved me hours of work - many many thanks :-)

Wendy


Glad to help. Thanks for the feedback.
--ron
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
Advanced text function (combining text) Johan[_2_] Excel Worksheet Functions 2 March 27th 08 10:05 PM
Advanced text function Eva Excel Worksheet Functions 5 April 2nd 07 09:30 PM
Advanced formula/inserting text question Chas Excel Worksheet Functions 5 March 15th 06 06:13 AM
Advanced filtering on text and blanks dtencza Excel Discussion (Misc queries) 4 March 14th 06 01:07 AM
Advanced Filter using Date represented as text drice Excel Worksheet Functions 1 December 15th 04 04:56 PM


All times are GMT +1. The time now is 07:27 AM.

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

About Us

"It's about Microsoft Excel"