【解決方法】Microsoft XLODBC クエリ – 10 進数に (, ) 区切り記号が使用されているため、Excel で複数の列の値を追加できない

プログラミングQA


I have a column in Excel where values are inserted as decimals, and decimals are presented by the (,) separator. Whenever I am trying to sum the values of the column, I am getting the wrong answer because decimal values are not stored with a (.) separator. I need to know how I can sum the decimal values of multiple rows by using the (,) separator.

Exapmle

23,15

23,15

Sum = 46.30 expected 

私が試したこと:

SELECT Data.P, Data.co,Data.comp,SUM(Switch(Data.Sens='D',1, Data.Sens='C', -1, TRUE, 1)* Data.Montant) AS Montant FROM data.txt 

解決策 1

見る VBA マクロ – 地域と言語[^] ロケール設定を変更する方法については。

解決策 2

schema.ini ファイルを使用することをお勧めします。 見る: Schema.ini ファイル (テキスト ファイル ドライバー) – Open Database Connectivity (ODBC) | マイクロソフト ラーン[^]

設定できるオプションがいくつかあります。 例えば:

[data.txt]
DecimalSymbol=.
Format=Delimited(;)
ColNameHeader=False
MaxScanRows=0

コメント

タイトルとURLをコピーしました