开发者

Bypass excel csv formula conversion on fields starting with + or -

I have a csv file with contents:

"x","y","-z"

When I import it I get:

Bypass excel csv formula conversion on fields starting with + or -

How can I bypass this conversion?

Update

If you try:

   "x","y",="-z,a"

The ",a" is not imported.

If you put a space in front:

   "x","y",=" -z"

or

   "x","y"," -z"

it will 开发者_运维问答work fine


Prefix the values with equals signs

="x",="y",="-z"


Your problem is that by using the CSV extension, you are forcing excel to interpret the file using its very strict CSV conventions, and this will often go against whatever it is you're trying to do unless the CSV file was originally created by Excel. Your easiest, and most reliable method of importing this CSV file, is to rename it to a TXT file, and then use the import function in excel to coerce columns in exactly the way you want.


There is a complete difference in using Excel > Import and double-click a .CSV file. Different parsers are used.

Based on the comments above, I figured out that prepending a space before a '+' or '-' sign works for the double-click .CSV file case. So my file now contains e.g.

" +14";" -Foo"


I tried your first example in Excel 2003 and could reproduce your #NAME eror.

My solution was to open the text file and to specify the 3rd column as "Text" in the import wizard (3rd page) - along with choosing the correct delimiter and text qualifier (2nd page).

No changes needed to the text file.


I would prefer to solve such problem directly during the conversion, by giving the right column format, example: use Text format for the column that should contain operation sign:

Bypass excel csv formula conversion on fields starting with + or -

Check this detail post: http://ask.osify.com/qa/854


Find and replace every instance of + with ' +

A single quote and space at the beginning should cancel out any +, -, or =.


You also will need to transform 1.5 numbers to 1,5 strings, so they don't changed to date type values.

For + - = I use space method " +...." - not great, but for my task was enough.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜