Excel VBA Komma Punkt Tausend Zahl Problem.

DocAElstein

Banned user
Joined
May 24, 2014
Messages
1,336
'
'. Sorry, Leute es taucht mal wieder auf : das Excel VBA Komma Punkt Tausend Zahl Problem. Bei mir ist es so: zuerst wie jeder hab ich das übliche Problem mit dem Deutsch / Englisch, Komma punkte Konvention. Mit sorgfältig Komma durch Punkt ersetzen komme ich nach einige Mühe meist OK. Jetzt aber neue Probleme. Egal wie ich Punkt oder Komma umtauschen mit VBA, und egal wie die Zahl gezeigt wurde, kommt es immer mal vor , das für zahlen > 1 die mehr als 2 zahlen nach den Komma oder Punkt haben wird bei VBA um gewandelt zu tausend. Z.b 1.001 oder 1,001 wird zu 1001. Es kommt aber nicht immer vor.
'. (.Zusätzlich wird (auch nicht immer) Zahlen umgewandelt zu Datum!!).
'. Ein Punkt zu Komma umtausch reicht nicht immer dann aus, um eindeutig festzulegen genau was der Punkt oder Komma zu bedeuten hat.
'. Als Zwischenlösung habe ich 2 folgendere Lösungen beim Ausprobieren ausgefunden
'.1) vor und nach jede VBA Berechnung wird, für jede Nummer >1, nur 2 zahl noch der Punkt oder Komma erlaubt zB. Mit Code etwa. wie

If Cells(j, i) > 1 then
Cells(j, i).Value _
= Application.WorksheetsFunction.RoundDown(Cells(j, i), 2)
Else
End If

'. -allerdings hab ich hier die Nachteil das ich verliere die Genauigkeit.
'.2) wenn ich immer, statt mit VBA, den Punkt zu Komma austauschen manuell (Via Start - Suchen und Auswahlen - usw.) dann taucht das Problem nicht auf. Eventuell liegt das Problem da? Bzw. die VBA Code (Die ich aus eine Makro bekommen habe) verursacht das Problem? Die VBA Code das ich habe gekriegt von eine Makro sieht etwa. so aus:

Replace What:="." Replacement:=",", LookAt:mad:lPart, _
SearchOrder:= xlbyRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'
'. Übrigens a) : es kommt mir auch manchmal vor wenn ich einige Zahlen aus den Internet Sites kopieren übers Zwischenablage zu Excel das eine Punkt wird zu tausender umgewandelt.
' . b) Auch wenn ich in einer Zelle eine Nummer mit einem Punkt rein tippe, krieg ich eine tausend Werte, eine Datum oder sonstiger!!!
'. Hat jemand eine Idee? ZB. Gibt es eine besserer Austausch bzw. Kopie oder einfügen VBA Code als das
'die die Makro erzeugt?
'
'Danke, Thanks, im Voraus (Ich bin übrigens ein alter englischer Physiker, der erst seit kurzem, sehr spät mit Computern angefangen hat - für private Zwecke).
'
'Dr.Alan Elston
 
Last edited by a moderator:

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I am having difficulty understanding exactly what line of code is altering your values by converting a thousands separator to a decimal. You appear to be posting lines of code that should not cause problems. Are you saying that this statement:


Code:
Cells(j, i).Value = Application.WorksheetsFunction.RoundDown(Cells (j, i), 2)


Is converting 1.001 to 1001?


—————————————————————————————————


Ich habe Schwierigkeiten zu verstehen, was genau Codezeile Änderung Ihrer Werte wird durch Umwandlung eines Tausendertrennzeichen in eine Dezimalzahl. Sie scheinen zu veröffentlichen Codezeilen, die keine Probleme verursachen sollte. Wollen Sie damit sagen, dass diese Aussage:


Code:
Cells(j, i).Value = Application.WorksheetsFunction.RoundDown(Cells (j, i), 2)


Ist die Umwandlung von 1,001 bis 1001?
 
Upvote 0
Hi, thanks for the Reply

The quick answer to you is NO ……

. ………The rounding code I wrote is not the problem. As you say it works. The rounding code I wrote is simply a temporary solution that helps to cut down on my problem. That is because some of my problems start when a number is >1 and has more than 2 figures after decimal delimiter, (the point or comer.)
. I think the crux of my problem is that I am using a German version of Excel. In German they use a comer instead of a point for the decimal point. (For example One and a half looks like 1.5 in English and 1,5 in German)
. Also, in German they sometimes use a point as a thousand separator instead of a comer as in English (A Million in English is 1000000 or 1,000,000 or 1,000,000.0 ; In German it is 1000000 or 1.000.000 or 1.000.000,0)
. I probably did not explain the problem too well, so I will try again with an actual Example.
.
. I have written a VBA program that takes the nutrition values that I copy from a German Web site

. ( Apfel roh | Kalorien | Nährwerte | Analyse | Lebensmittel - ernaehrung.de )

. and sorts them out in an order I need in a Excel Spreadsheet, (which I have written for assisting my wife in her Diet!),
. But firstly I must copy and paste the tables manually (Using Excel to access data from a web site is for a starter like me a bit too difficult!!)
. So, before I play the VBA code, I copy, for example the first table into a German Excel table in a worksheet. I then get something like this:-

____________________________________________________________________

Hi, danke fürs Antwort
Kurz gesagt, NEIN….
…..Die Runden Code das ich geschrieben habe ist nicht das Problem. Wie Sie sagen, es funktionieret. Diese Runden Code ist eine provisorisch Lösung das meine Problem minimieret. Das ist weil manche meine Probleme fang zu erste an wenn eine Nummer ist >1 und mehr als 2 zahlen nach dem dezimal Trennzeichen hat. (Punkt oder Komma)
. Ich denke die Haupt Ursache meine Problem ist das ich benutzen (muss / will) eine Deutscher Excel Version. In Deutsch wird eine Komma statt Punkt als dezimalen Trennzeichens bemützt. (Zum Beispiel Eins und eine halb sieht so aus 1.5 in Englisch ; 1,5 in Deutsch)

. Auch in Deutsch wird manchmal ein Punkt als Tausend Trennzeichen bemützt statt ein Komma wie in Englisch (Zum Beispiel a Million in Deutsch sieht so aus 1.000.000 oder 1.000.000,0 oder 1000000 statt 1,000,000 oder 1,000,000.0 oder 1000000 in Englisch

. Ich Habs eventuelle meine Problem nicht gut geklärte. Deswegen gebe ich eine bestimmt Beispiel

….. Ich habe eine VBA Code geschrieben damit ich die Nährwerte aus ein internett Site


( Apfel roh | Kalorien | Nährwerte | Analyse | Lebensmittel - ernaehrung.de )

Benutzen kann in eine spreadsheet ich geschrieben habe (um mein Frau mit ihren Diät zu Hilfen!)
. Aber ich muss zu erste kopieren und einfugen die Tabelle Manuel (Die benutzen von VBA um werte aus seine Internett Site zu kriegen ist für jetzt etwa zu komplizieret für ein Anfänger wie ich!!)
. Also vor ich meine Makro starten, ich kopieren und einfugen die Tabelle in meine Deutscher Excel Tabelle in ein Mappe. Ich krieg dann etwa wie:-



Broteinheiten 0.95 01. Feb ↑ (+26)
Kilokalorien 52 61 ↑ (+17)
Kilojoule 217 255 ↑ (+18)
Eiweiß 0.34 0.34 - g
Fett 0.4 0.049 ↓ (-88) g
Kohlenhydrate Nov 43 14.35 ↑ (+26) g
Alkohol 0 0 - g
Wasser 85.07 82.47 ↓ (-3) g
Ballaststoffe 2 02. Jan ↑ (+1) g
Cholesterin 0 0 - mg
Mineralstoffe 0.3 0.32 ↑ (+7) g


If you are able to compare this with the table with that on the web site you will see that some numbers have been changed to a Date. (This may not happen to you if you are using an English version of Excel.) I have tried endless ways to solve this problem but it’s a bit of a vicious circle. For example, to avoid a “number to date conversion” problem I can sometimes get away with changing the point for a comer. But then that sometimes gives me the problem that somewhere along the line a number like one and a half, written as 1,500 will be wildly converted to one and a half thousand and comes out as 1500

Always limiting to 2 decimal points for numbers > 1 minimizes my problems but doesn’t solve the “number to date change” problem, or can sometimes make it worse!!! (In addition, of course I lose a bit of accuracy but for my project that’s not too important.)

I think the only sensible solution to my problem is to change the default settings to English. I do not know how to do this and am a bit nervous about trying, as I do not want the change to affect all my Excel work. If there is a way to change these default settings for a particular workbook, then that would possibly be the solution to my problem or at least worth a try!!!???

Thanks again..
Alan

________________________________________________________

Falls sie vergleichen kann das mit die Website Tabelle, sie wurden sehen das manche zahlen Werte sind umgewandelt zu Datum werte (Evtl. passieret das ihnen nicht wenn sie haben eine Englischer Excel). Ich hab endlos versuchte dieses Problem zu Beseitigung. Aber es ist etwas von eine Teufels Krise. Zum Beispiel, eine “nummer zu Datum Konversion” Problem kann manchmal beseitigt wurden beim ersetzen ein Punkt mit eine Komma. Aber dann krieg ich eventuelle irgendwann später eine Problem wobei eine Nummer wie eine und ein halb (geschrieben als 1,500) wäre willkürlich umgewandelt zu eine und halb Tausend als 1500

. Wenn ich immer einschränken zu nur zwei stellen nach dem dezimal Trennzeichen dann ist dieses Problem minimisieret. Aber dann hab ich trotzdem manchmal die “nummer zu Datum Konversion” Problem noch oder sogar noch mehr zusätzlich!! (Auch vollere ich etwas Genauigkeit, aber für meinen Zweck ist das nicht zu wichtig)

. Ich vermute die einziger vernünftig Lösung zu meinem Problem ist um die Standardeinstellung zu Englisch zu ändern. Ich weise nicht wie man das macht, und ich bin etwa nervös um das zu probieren, weil ich will nicht das es trifft alle meine Excel Arbeit. Falls es gibt eine weg um diese Einstellung nur für eine bestimmt Workbook zu machen dann wäre das evtl. das Lösung zu meine Probleme, oder mindestens eine versuche werte???

Danke nochmal
Alan
 
Upvote 0
I do not have any experience in using Excel with any language configuration other than English. But you might try do a manual Text to Columns (on the Data tab). Step 3 of the wizard offers an "Advanced" button. If you click that, then you can alter the thousands indicator and the decimal indicator. This settings "stick" and they're what Excel uses to partse data when you paste in text. You might be able to alter the parsing away from the default parsing logic by doing this.


Ich habe keine Erfahrung im Umgang mit Excel mit jeder Sprache anders als Englisch-Konfiguration. Aber Sie könnten versuchen, eine manuelle Text in Spalten (auf der Daten-Register). Schritt 3 des Assistenten bietet eine Schaltfläche "Erweitert". Wenn Sie, dass Sie, dann können Sie die Tausende Anzeige und das Dezimal-Anzeige ändern. Diese Einstellungen "kleben" und sie sind, was Excel verwendet, um Daten zu analysieren, wenn Sie in Text einzufügen. Möglicherweise können Sie die Analyse, indem Sie diese von der Standard-Verarbeitungslogik verändern.

Text to columns A.png
Text to columns B.jpg
Text to columns C.png
 
Last edited:
Upvote 0
Hello, Hallo
Thanks for the reply.. It reminded me of something I had to do last week when I tried to import a small text file from England, that is to say one with English Point and Comer conventions..(With klicking on data tab or by opening as text file….. the same wizard comes up in both methods)…..
……I had to do the same as you suggest to alter the thousands indicator and the decimal indicator. I then got sensible results.
.... So I reopened that file and played around with that copied Internet data that I spoke about yesterday.. But still no success.

However I have another temporary solution as follows:-
.. If you click on the Microsoft sign up there in the left hand corner, then Excel Option then advanced .. you get the chance to change the point and Comer convention.
.. Then at first glance that seems to sort out my problem.

(. However I have to make sure that I change it back when working on my other German files or else I sometimes get some very strange problems in (usually just a few) of my formulas and calculations.. These problems seem to be related to another annoying problem that crops up from time to time, whereby a warning tells me that “there is an apostrophe ‘ added to a text or number, even though it is not visible to the naked eye??)

But anyway, I think I’m getting a bit further
Thanks for your help.

Alan
P.s. As a parallel solution to my overall problem I’m trying to get hold of and manipulate the original Data files that are used in the internet sites, and that’s going nicely as well both as a result of a thread I have in the ACCESS Forum, and also the other threads I have to do with copying data, one of which of course you are active in!!............

……………………………………………………..

Danke fürs Antwort . Es hat mir ja erinnerte an etwas ich letzte Woche gemacht habe. Damals ging es an importieren eine kleine Englisch Txt File, bzw. Einer mit Englischer Punkt und Komma Konventionen. (Entweder beim klicken an daten Register oder beim offen als Text File.. da kommt ja die gleicher Wizzard dann…)

.. ich musste die gleicher machen wie was sie mir empfehlet habe und damit die Tausende Anzeige und das Dezimal-Anzeige ändern. Alles hat dann gut funktionieret und alles seiht normal aus.
.. Dann habe ich gerade mit diese File eine bisschen um gespielte mit die kopieret Internet Sachen die ich darüber gesprochen gestern habe. Leider ohne Erfolg.

Allerdings fand ich noch eine provisorische Lösung:--

Mann geht links üben und klickt an die Microsoft anzeige. Dann an excel-optionen dann an erweitert. Darin kann man die Punkt , Komma zeug ändern.
.. dann scheint bis jetzt meine Problem weg!!!..

(allerdings ich Mus vorsichtig und wenn ich an andere workbooks arbeiten dies alles zurück setzten. Sonst krieg ich seltsam Probleme mit Nummern und Berechnung (aber nur eine gering menge). Diese Problem scheint etwas zu tun mit eine anderer ärgerliche Probleme das (nur manchmal) plötzlich auf taucht bei mir… Ich krieg eine Warnung das eine Apostrophe ` da ist beim an zahlen oder Text werte, obwohl wenn man schaut man seiht da keine Apostrophe!!)

Aber jedenfalls, ich komm eine bisschen weiter
Danke für ihrer Hilfe.
Alan
Übrigens.. Als parallel Losung ich versuche aufs die original Daten die beim die internett Site bemützt ist zu kommen und manipulieren. Damit habe ich gut Threads in die Access Forum und auch andere zu tun mit kopieren Daten.. da sind sie auch ja dabei..

..bis dann…
 
Upvote 0
Hi,

Not too important. Just a very quick “edit” to my last reply:-
…” ….. If you click on the Microsoft sign up there in the left hand corner, then Excel Option then ……..” :-
. .I just notice that this is only for Excel 2007. Sorry!! For Excel 2010 it is slightly different.. :- there is an extra Box up there left almost at the top with the name “File” . If you click on that you get similar options as by clicking on the Microsoft symbol in Excel 2007. (I.e. Option instead of Excel-Option)

Nichts wichtig. Nur ganz schnell Korrektor zu meine letzter Antwort:- :--
….“…..Mann geht links üben und klickt an die Microsoft anzeige. Dann an Excel-Optionen dann ……“
. ……Ich hab zufällig bemerkt das das nur für Excel 2007 ist. Sorry!! Es ist in Excel 2010 eine bisschen andreres.. :- Links fast ganz oben ist ein extra Kiste mit die Name „Datei“. Wenn man da drauf klicken, kriegt man ja ähnlicher Optionen wie wenn man an die Microsoft Symbole in Excel 2007 (zB. Optionen statt Excel-Optionen)



Alan Elston (Dr. AElstein)
Hof,
16 Juni:- Schlappen Tag (Famous Beer Drinking Day in Hof!!!!)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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