#### achu

##### Member

Dear expart,

kindly help me with this function ,

i have puting formula with sumifs with date range select

kindly solve this formula,

Advanced thank you

kindly help me with this function ,

i have puting formula with sumifs with date range select

kindly solve this formula,

Advanced thank you

Code:

```
Sub Galaxy_payment()
Const externalwbk As String = "Vinit-Master Payment Sheet.xlsx"
Const externalwsht As String = "Data"
Dim inputrange As Range
Dim tablename As String
Dim pathname As String
Dim mydate As Date
mydate = DateSerial("$D$16", "$C17", "$B17")
pathname = ThisWorkbook.path
If Right(pathname, 1) <> "\" Then pathname = pathname & "\"
Set inputrange1 = Sheets("Report").Range("D17:D28")
With Workbooks(externalwbk).Worksheets(externalwsht)
lastrow = .Range("A2").End(xlDown).Row
If .ListObjects.Count > 0 Then
tablename = .ListObjects(1).Name
If .Range("A2:L" & lastrow).Address = .ListObjects(tablename).DataBodyRange.Address Then
End If
End If
inputrange1.Formula = "=Sumifs(" & "'" & pathname & "[" & externalwbk & "]" & externalwsht & "'" & "!" & "$AQ$2:$AQ$" & lastrow & "," & _
"'" & pathname & "[" & externalwbk & "]" & externalwsht & "'" & "!" & "$C$2:$C$" & lastrow & "," & "$C$4" & "," & _
"'" & pathname & "[" & externalwbk & "]" & externalwsht & "'" & "!" & "$F$2:$F$" & lastrow & "," & mydate & ")"
End With
End Sub
```

Last edited by a moderator: