celicantes
New Member
- Joined
- Dec 4, 2018
- Messages
- 3
Hello folks,
I am stuck with a VBA sumifs code in excel.
Basically, I am trying to get a SUMIFS that should retrieve for each date the value in the sum_range greater than the dates range previously input in a third cell.
In a normal formula would be:
=SUMIFS(SUM_RANGE, CRITERIA_RANGE, CRITERIA1, CRITERIA_RANGE, ">=" & STARTDATE, CRITERIA_RANGE, "<" & ENDDATE)
That's my code in VBA:
Sub test ()
For i = 4 To 368
StartDate = Sheets("Sheet1").Range("C5")
EndDate = Sheets("Sheet1").Range("C6")
bridge_t = Application.WorksheetFunction.SumIfs([iss_ceduto], [iss_date], Cells(i, 15), [iss_date], ">=" & StartDate, [iss_date], "<" & EndDate)
Cells(i, 17) = bridge_t
Next i
End sub
The code in VBA returns 0, while it works perfectly as a Formula.
Any idea how to help me?
Thanks in advance for any feedback.
Elio
I am stuck with a VBA sumifs code in excel.
Basically, I am trying to get a SUMIFS that should retrieve for each date the value in the sum_range greater than the dates range previously input in a third cell.
In a normal formula would be:
=SUMIFS(SUM_RANGE, CRITERIA_RANGE, CRITERIA1, CRITERIA_RANGE, ">=" & STARTDATE, CRITERIA_RANGE, "<" & ENDDATE)
That's my code in VBA:
Sub test ()
For i = 4 To 368
StartDate = Sheets("Sheet1").Range("C5")
EndDate = Sheets("Sheet1").Range("C6")
bridge_t = Application.WorksheetFunction.SumIfs([iss_ceduto], [iss_date], Cells(i, 15), [iss_date], ">=" & StartDate, [iss_date], "<" & EndDate)
Cells(i, 17) = bridge_t
Next i
End sub
The code in VBA returns 0, while it works perfectly as a Formula.
Any idea how to help me?
Thanks in advance for any feedback.
Elio