Text to columns

csilabgirl

Active Member
Joined
Aug 14, 2009
Messages
359
Excel 2002

I am pasting some data into a spreadsheet and then using TEXT TO COLUMNS to separate it based on the "=". I have long international phone numbers such as seen below that when I paste them in and use TEXT TO COLUMNS, it convers the phone number to scientific notation, even if I have already set the column format that it will be separating the data into as "TEXT" instead of general. Any ideas on how I can prevent this?

<TABLE style="WIDTH: 197pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=262 x:str><COLGROUP><COL style="WIDTH: 197pt; mso-width-source: userset; mso-width-alt: 9581" width=262><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #ece9d8; BORDER-LEFT: #ece9d8; BACKGROUND-COLOR: transparent; WIDTH: 197pt; HEIGHT: 12.75pt; BORDER-TOP: #ece9d8; BORDER-RIGHT: #ece9d8" height=17 width=262>Phone #1 = 2358038402118

Because the phone number is never on the same row when I paste the data in, I cannot use formulas like RIGHT() to obtain it, I have to use text to columns. Thank you for the help.
</TD></TR></TBODY></TABLE>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello,

It is very likely I found this code on this site. I use it all the time but I can not take credit for it. I just create a button in the ribbon and direct it to this code. Do not select entire columns or it will take forever to run. However, if you select a block of numbers and run this code, it should do exactly what you want. I hope this helps.

Phil

Code:
Sub ConvertToText()
    
        Application.ScreenUpdating = False
        
        'Convert only cells with data in selected column to Text format.
        
        'Range(ActiveCell.End(xlDown), ActiveCell.End(xlUp)).Select
            With Selection
                .NumberFormat = "@"
            End With
          
        'Cycle through selected cells (Remove Ticks or Trim)
        Application.Calculation = xlCalculationManual  'pre XL97 xlManual
            Dim cell As Range
            Dim ix As Long
            Dim tCells As Long
            tCells = Selection.Count
                For ix = 1 To tCells
                Selection.Item(ix).Formula = Trim(Selection.Item(ix).Formula)
                Next ix
        Application.Calculation = xlCalculationAutomatic  'pre XL97 xlAutomatic
        Application.ScreenUpdating = True
        
    End Sub
 
Upvote 0
Hello Again,

I may have misread your request. I'm working in 2007. When I have a row of data and I select Text to Column and enter an = sign as the separator, it seems to work for me. It is giving me the Text to Columns Wizard and allowing me to change the second column created to Text. I'm unable to recreate your dilemma. Sorry if I wasn't much help.

Phil
 
Upvote 0
The number is only being DISPLAYED in scientific notation.
The actual number is still there.

You could just change the format of the cell to number AFTER the text to columns..
 
Upvote 0
PhilW, thank you for trying to help.

Jonmo - thank you for the suggestion, I can program that into the macro
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top