convert number stored as text to number without rounding the numbers

star_saty

New Member
Joined
Jul 6, 2014
Messages
2
Hi All,

I am looking for a VBA code for the below issue, Please help.

I am stuck where i have to convert the number which are stored as text and i have to convert them in number format and it should not round up the numbers.
Below is the sample data for your reference. once data gets convert to number it should look like as it is but it should be converted into number format.

In Excel When number are in text format they are aligned to Left but once it get converted to number format they are align to Right

See below screencap of the same.

Text Format Data
Column1Column2Column3
1.32355190.926604.38
0.5704863.172505.14
0.8945527.2513438.28

<tbody>
</tbody>


After converting above to number format it should look like below
Column1Column2Column3
1.32355190.926604.38
0.5704863.172505.14
0.8945527.2513438.28

<tbody>
</tbody>



Your help will be highly appreciated.
Thanks in advance
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Welcome to MrExcel.

Have you tried Data|Text To Columns|Finish? The macro recorder will give you the VBA code.
 
Upvote 0
Hi Andrew,

I am using below code to do the task but it roundup the number. Below code roundup the number to 1 digit.

sub report()
Range("A2:A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Call Number
End sub

Sub number()
Range("A2:A4").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Select
With Selection
Selection.NumberFormat = "0"
.Value = .Value
End With
End Sub
 
Upvote 0
The code doesn't do any rounding. But this line formats the numbers with zero decimal places:

Code:
Selection.NumberFormat = "0"

Try using the General number format.
 
Upvote 0

Forum statistics

Threads
1,215,529
Messages
6,125,344
Members
449,219
Latest member
Smiqer

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