Hi all

I have the following code to sum cost in column J if the following criteria is met:

1 If the specified GLCode is in column P
2 If the specified start date (FromDate) is in column L
3 If the specified end date (ToDate) is also in colmn L
4 If the specifiedfile name (in this instance MasterFile_00) is in column Z

My problem is that I need increase the number of criteria 4 to about 20 files to check (MasterFile_12, MasterFile_19, MasterFile_34 and so on).

How could I amend the code to check occurance of these file names for inculding in the sumifs formula?

Code :

DateNow = Date

    FromDate = DateSerial(Year(DateNow), Month(DateNow), 1)

    ToDate = DateSerial(Year(DateNow), Month(DateNow) + 1, 0)
     
    InMonth = FormatCurrency(Application.WorksheetFunction.SumIfs(.Range("J:J"), _
                                                                        .Range("P:P"), GLCode, _
                                                                        .Range("L:L"), ">=" & FromDate, _
                                                                        .Range("L:L"), "<" & ToDate, _
                                                                        .Range("Z:Z"), "MasterFile_00"))
Many thanks