Importing numbers from external source: how to convert text in numbers

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

I'm struggling with sums.
I mean: I've just imported data from an external source.

https://imgur.com/a/7ln2Ti6

As you can see in the image, in the column "Amount" I've imported number, but if I select all (or apply whatever formula), nothing happens in terms of calculating total.

If I enter each cell and press enter, then text is shifted on the right of the cell and converted in numbers (see column on the right).

How can I arrange this problem in vba?

Thank's.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Record a Macro using the Text To Columns feature and modify to suit.
There can be an issue with Non-Breaking Space characters depending on your source, CHAR(0160).

If it turns out you need to remove those characters, this snippet can take care of them by removing.
Alternatively, you mad need to change them to a normal space character.
Code:
Sub Code_160()
'
' Code_160 Macro
'Removes all Characters of Code 0160 from Active WorkSheet
'This Character Code is often included in copied or downloaded
'spreadsheet data that interferes with Excel evaluations.
'Add to the QAT with suitable Icon. Suggestion is the "Unhappy" Face

    Cells.Replace What:=" ", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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