HERBERS Excel-Forum - das Archiv

Thema: Gemischter Mittelwert | Herbers Excel-Forum

Gemischter Mittelwert
Fritz

Hallo, ich brauche Hilfe
Ich möchte einen gemischten Mittelwert berechnen.
Also:
in A1 zu A100 steht die Stückzahl
In B1 zu B100 steht der Preis pro Stück
Ich möchte in einer Formel oder in einem Makro den Gemischten Mittelwertermitteln
Also B1:A1 + B2:A2 usw..... geteilt durch die Anzahl von A1 bis A100
Kann mir jemand helfen
Gruß
Fritz

AW: Gemischter Mittelwert
Rudi

Hallo,
=Summenprodukt(A1:A100;B1:B100)/Anzahl(A1:A100)
Gruß
Rudi
AW: Gemischter Mittelwert
welga

Hallo,
wenn es möglich eine Hilfsspalte einzufügen dann probier das mal:
Sub berechnen()
Dim i As Long
Dim mit() As Variant
Dim a As Long
a = 0
With ThisWorkbook.Sheets(1)
For i = 1 To 100
If .Cells(i, 1).Value = "" Then GoTo rechnen
.Cells(i, 3).Value = .Cells(i, 2).Value / .Cells(i, 1).Value
a = a + 1
Next i
rechnen:
.Cells(1, 4).Value = 0
For i = 1 To a
.Cells(1, 4).Value = .Cells(i, 3).Value + .Cells(1, 4).Value
Next i
.Cells(1, 4).Value = .Cells(1, 4).Value / a 'Gemischter Mittelwert
End With
End Sub

Gruß
welga
AW: Gemischter Mittelwert
Fritz

Danke, muss es erst probieren