المعدلة تعمل
المبلغ
=IF($C$2="الكل";SUMIFS(D5:D18;$B$5:$B$18;">="&$A$2;$B$5:$B$18;"<="&$B$2);SUMIFS(D5:D18;$B$5:$B$18;">="&$A$2;$B$5:$B$18;"<="&$B$2;$C$5:$C$18;$C$2))
الدين
=IF(C2="الكل";SUMIFS(E5:E18;$B$5:$B$18;">="&$A$2;$B$5:$B$18;"<="&$B$2);SUMIFS(E5:E18;$B$5:$B$18;">="&$A$2;$B$5:$B$18;"<="&$B$2;$C$5:$C$18;$C$2))
ودي تعديل للكود لاخي حسين مامون للكل
Sub tot()
Dim lr, x, to1, to2
Dim Dt1, Dt2
to1 = 0
to2 = 0
Dt1 = [a2]
Dt2 = [b2]
lr = Cells(Rows.Count, 2).End(3).Row
If Cells(2, 3) <> "الكل" Then
For x = 5 To lr
If Cells(x, 3).Text = Range("c2") Then
Select Case Cells(x, 2).Value2: Case Dt1 To Dt2
to1 = to1 + Cells(x, 4).Value
to2 = to2 + Cells(x, 5).Value
End Select
End If
Next x
ElseIf Cells(2, 3) = "الكل" Then
For x = 5 To lr
Select Case Cells(x, 2).Value2: Case Dt1 To Dt2
to1 = to1 + Cells(x, 4).Value
to2 = to2 + Cells(x, 5).Value
End Select
Next
End If
Range("d2").Value = to1
Range("e2").Value = to2
End Sub