Code for Create Function Sumifs
Sub Button1_Click()
Dim item_name As String
Dim Customer_name As String
Dim total As Long
total = 0
item_name = Worksheets("Sheet1").Cells(2, 8).Value
Customer_name = Worksheets("Sheet1").Cells(2, 9).Value
lastrow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
If Worksheets("Sheet1").Cells(i, 2).Value = item_name And Worksheets("Sheet1").Cells(i, 2).Value = Customer_name Then
total = total + Worksheets("Sheet1").Cells(i, 4).Value
End If
Next
Worksheets("Sheet1").Cells(2, 10).Value = total
Worksheets("Sheet1").Cells(1, 1).Select
End Sub
Please Watching My Video is Below
No comments:
Post a Comment