Hallo zusammen,
ich habe jetzt das zusammengebastelt:
Function Berechne(txt As String)
txt = Application.Substitute(txt, " ", "")
txt = Application.Substitute(txt, ",", ".")
txt = Application.Substitute(txt, "x", "*")
txt = Application.Substitute(txt, "X", "*")
If InStr(txt, "ø") > 0 Then
Dim i As Integer
For i = 10000 To 1 Step -1
txt = Application.Substitute(txt, "ø" & i, "")
Next i
End If
txt = Application.Substitute(txt, "ø", "")
txt = Application.Substitute(txt, "tief", "")
txt = Application.Substitute(txt, "hoch", "")
txt = Application.Substitute(txt, "breit", "")
txt = Application.Substitute(txt, "Tief", "")
txt = Application.Substitute(txt, "Hoch", "")
txt = Application.Substitute(txt, "Breit", "")
txt = Application.Substitute(txt, "m", "")
txt = Application.Substitute(txt, "M", "")
txt = Application.Substitute(txt, "mm", "")
txt = Application.Substitute(txt, "MM", "")
txt = Application.Substitute(txt, "×", "*")
txt = Application.Substitute(txt, "A", "")
txt = Application.Substitute(txt, "B", "")
txt = Application.Substitute(txt, "C", "")
txt = Application.Substitute(txt, "D", "")
txt = Application.Substitute(txt, "E", "")
txt = Application.Substitute(txt, "F", "")
txt = Application.Substitute(txt, "G", "")
txt = Application.Substitute(txt, "H", "")
txt = Application.Substitute(txt, "I", "")
txt = Application.Substitute(txt, "J", "")
txt = Application.Substitute(txt, "K", "")
txt = Application.Substitute(txt, "L", "")
txt = Application.Substitute(txt, "M", "")
txt = Application.Substitute(txt, "N", "")
txt = Application.Substitute(txt, "O", "")
txt = Application.Substitute(txt, "P", "")
txt = Application.Substitute(txt, "Q", "")
txt = Application.Substitute(txt, "R", "")
txt = Application.Substitute(txt, "S", "")
txt = Application.Substitute(txt, "T", "")
txt = Application.Substitute(txt, "U", "")
txt = Application.Substitute(txt, "V", "")
txt = Application.Substitute(txt, "W", "")
txt = Application.Substitute(txt, "Y", "")
txt = Application.Substitute(txt, "Z", "")
txt = Application.Substitute(txt, "ß", "")
txt = Application.Substitute(txt, "Ü", "")
txt = Application.Substitute(txt, "Ö", "")
txt = Application.Substitute(txt, "Ä", "")
txt = Application.Substitute(txt, "a", "")
txt = Application.Substitute(txt, "b", "")
txt = Application.Substitute(txt, "c", "")
txt = Application.Substitute(txt, "d", "")
txt = Application.Substitute(txt, "e", "")
txt = Application.Substitute(txt, "f", "")
txt = Application.Substitute(txt, "g", "")
txt = Application.Substitute(txt, "h", "")
txt = Application.Substitute(txt, "i", "")
txt = Application.Substitute(txt, "j", "")
txt = Application.Substitute(txt, "k", "")
txt = Application.Substitute(txt, "l", "")
txt = Application.Substitute(txt, "m", "")
txt = Application.Substitute(txt, "n", "")
txt = Application.Substitute(txt, "o", "")
txt = Application.Substitute(txt, "p", "")
txt = Application.Substitute(txt, "q", "")
txt = Application.Substitute(txt, "r", "")
txt = Application.Substitute(txt, "s", "")
txt = Application.Substitute(txt, "t", "")
txt = Application.Substitute(txt, "u", "")
txt = Application.Substitute(txt, "v", "")
txt = Application.Substitute(txt, "w", "")
txt = Application.Substitute(txt, "y", "")
txt = Application.Substitute(txt, "z", "")
txt = Application.Substitute(txt, "ü", "")
txt = Application.Substitute(txt, "ö", "")
txt = Application.Substitute(txt, "ä", "")
txt = Application.Substitute(txt, "xx", "x")
txt = Application.Substitute(txt, "//", "/")
txt = Application.Substitute(txt, "**", "*")
txt = Application.Substitute(txt, "--", "-")
txt = Application.Substitute(txt, "++", "+")
txt = Application.Substitute(txt, "+x", "+")
txt = Application.Substitute(txt, "++", "+")
txt = Application.Substitute(txt, "+/", "+")
txt = Application.Substitute(txt, "+-", "+")
txt = Application.Substitute(txt, "+*", "+")
txt = Application.Substitute(txt, "-x", "-")
txt = Application.Substitute(txt, "-+", "-")
txt = Application.Substitute(txt, "-/", "-")
txt = Application.Substitute(txt, "--", "-")
txt = Application.Substitute(txt, "-*", "-")
txt = Application.Substitute(txt, "xx", "x")
txt = Application.Substitute(txt, "x+", "x")
txt = Application.Substitute(txt, "x/", "x")
txt = Application.Substitute(txt, "x-", "x")
txt = Application.Substitute(txt, "x*", "x")
txt = Application.Substitute(txt, "/x", "/")
txt = Application.Substitute(txt, "/+", "/")
txt = Application.Substitute(txt, "//", "/")
txt = Application.Substitute(txt, "/-", "/")
txt = Application.Substitute(txt, "/*", "/")
txt = Application.Substitute(txt, "*x", "*")
txt = Application.Substitute(txt, "*+", "*")
txt = Application.Substitute(txt, "*/", "*")
txt = Application.Substitute(txt, "*-", "*")
txt = Application.Substitute(txt, "**", "*")
Berechne = Evaluate(txt)
End Function
Kann man das noch etwas kürzer/schneller machen?
Und es wäre gut eine Meldung zu bekommen wenn hinter dem Durchschnitte etwas größer 10000 steht.
Vielen Dank und viele Grüße Lutz