'Text' instead of number

R

RJB

I have spent two days manipulating data (about 300,000 cells' worth) I
imported as Fixed-Width (from MAS-90, if anyone cares).

The final step involves multiplying two numbers.

The POSITIVE numbers imported fine, the NEGATIVE numbers imported as

X.000-

and give me a #VALUE! error when I use any math function with them.

I have tried the Trimall macro.

I am guessing that somehow Excel thinks the '-' is a DASH and not a
negative... How do I change that????
 
A

Aladin Akyurek

Data|Text to Columns has an Advanced button (Excel 2003) for trailing
minuses you can check.
 
P

Peo Sjoblom

For Excel 2002 onwards you can use data>text to columns, clcik next twice, in
step 3 select advanced and trailing minus for negative numbers, click finish

in earlier versions you would need a macro or a help formula

Sub Fix_Minus()
Dim cell As Range
On Error Resume Next
For Each cell In Selection.Cells.SpecialCells(xlConstants, xlTextValues)
cell.Value = CDbl(cell.Value)
Next cell
End Sub

(press alt + f11, click insert module, paste in the above, press alt + q,
select the import, press alt + f8 and run the macro)

formula would be

=IF(RIGHT(A1,1)="-",-SUBSTITUTE(A1,"-",""),A1)

copy and paste special as values over the old range


Regards,

Peo Sjoblom
 
Top