Forum Discussion
TimBorm
Feb 09, 2020Copper Contributor
VBA sumif code
Hi All, please help with macro that will look for the same value in column and then sum value from another column. ex. id qyt sum 1111111 14 2222222 56 3333333 534 ...
TimBorm
Feb 09, 2020Copper Contributor
For next purpose it need to be done in VBA, but i think that i found the easiest way:
Option Explicit
Sub CreateUniqueList()
Dim lastrow As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
ActiveSheet.Range("B2:B" & lastrow).AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=ActiveSheet.Range("D2"), _
Unique:=True
End Sub
TimBorm
Feb 09, 2020Copper Contributor
my mistake :D:D this one:
Sub sumifFunction()
Range(“G2”) = “A”
Range(“H2”) = Application.WorksheetFunction.SumIf(Range(“A2:B8”), “A”, Range(“B2:B8”))
End Sub
Sub sumifFunction()
Range(“G2”) = “A”
Range(“H2”) = Application.WorksheetFunction.SumIf(Range(“A2:B8”), “A”, Range(“B2:B8”))
End Sub