Convert text to number for currency

Djbdrake

New Member
Joined
Oct 2, 2019
Messages
6
I need to write a macro for converting text to number. I have tried recording when I do text to columns but when I tried to run the macro under the same conditions as when it was recorded then it doesn't wok and the numbers stay as text. What do I need to do to make the text convert to a number?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Welcome to the Board!

Make sure you format the column first (to something other than "Text", like "General" or some number option), then do Text to Columns on that column. If you record that, it should so what you want, as long as you are always running it against the same column every time.

If that doesn't work, please post your recorded code along with a some sampling of your data entries.
 
Upvote 0
I tried doing that but it wouldn't work when I reset everything and tried running it again. The code came out as:

Range("D12:D50").Select
Selection.TextToColumns Destination:=Range("D12"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True

And the data set is :

£10.00
£20.00
£20.00
£2.50
£2.50
£2.50
£2.50
£2.50
£10.00
£10.00
£10.00
£10.00
£10.00
£10.00
£10.00
£10.00
£2.00
£2.00
£10.00
£20.00
£20.00
£75.00
<colgroup><col width="84" style="width: 63pt; mso-width-source: userset; mso-width-alt: 2986;"> <tbody> </tbody>
 
Upvote 0
If it is text, and the "£" symbol is in there as literal text, then you will need to remove that first.
Try doing a "Search and Replace", replacing the "
£" with nothing.
That, in and of itself, may be enough to convert all the entries to numbers. If not, do the Text to Columns after that.
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,215
Members
448,874
Latest member
b1step2far

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