Hi lakamas,
My last post with the lakamasII routine is driven by the G & H entries
You're welcome and thanks for the rep
![]()
Sub lakamasII(): Dim M As Long, Criteria As String, r As Long 'Clear the Output Column Columns("K").CurrentRegion.Offset(1, 0).ClearContents 'Get the Month wanted from N1 and initiate a dictionary M = Cells(1, "N"): With CreateObject("Scripting.Dictionary") 'Well scan all the entries in Column A to Load our dictionary For r = 2 To Range("A" & Rows.count).End(xlUp).Row 'We'll key our dictionary to the (concatenated with a pipe) first three column entries Criteria = Trim(Range("A" & r)) & "|" & _ Trim(Range("B" & r)) & "|" & Val(Range("C" & r)) 'If we've already seen that key we'll add to its sum total If .Exists(Criteria) Then .Item(Criteria) = .Item(Criteria) + Val(Range("D" & r)) Else: .Item(Criteria) = Val(Range("D" & r)) End If: Next 'Now well scan the Column G entries For r = 2 To Range("G" & Rows.count).End(xlUp).Row 'Keying on the G & H Columns and the wanted month (concatenated with a pipe) Criteria = Trim(Range("G" & r)) & "|" & _ Trim(Range("H" & r)) & "|" & M ' If that Key has been loaded we'll put the total in Colmn K 'or else we'll put a zero in that row If .Exists(Criteria) Then _ Range("K" & r) = .Item(Criteria) Else Range("K" & r) = 0 Next r: End With: End Sub
Bookmarks