Gruppe
UDF
Problem
Wie kann ich die Summe aller Kosten einer bestimmten Kostenart in einem vorgegebenen Quartal ermitteln?
StandardModule: basMain
Function Kosten(rng As Range, iQ As Integer, sK As String) As Double
Dim dValue As Double
Dim iRow As Integer
For iRow = rng.Row To rng.Rows.Count + rng.Row - 1
If CInt(Format(Cells(iRow, 1), "q")) = iQ Then
If Cells(iRow, 3) = sK Then
dValue = dValue + Cells(iRow, 2)
End If
End If
Next iRow
Kosten = dValue
End Function