Macro to create Summary from 2 Sheets as per Months in Col D and criteria in Col M
Hello All,
I have excel 2013
There are 3 sheets
Sheet1, Sheet2 and Summary
Data Starts from Row 12 on Sheet1 and Sheet2 (as shown in the sample attached)
I want a macro which when run should add values of Col I from both Sheet1 and Sheet2 corresponding to the Values in Col M (both highlighted in yellow color for explanation purpose) according to the Months in Col D on both Sheet1 and Sheet2
Currently I filter Col D by months and then filter Col M as per each values P,D,C and B then add them manually on the Summary Sheet
Col M on Sheet1 and Sheet2 is updated every other day so blanks in Col M should not be considered
Any help would be appreciated
Thanks in advance
Rehana
Last edited by rehana402003; 07-19-2018 at 05:57 AM.
Sub Demo1() Dim W, C@(), N%, R&, V, M% With Worksheets("Summary") W = .Range("A4", .[A4].End(xlDown)(0)).Value ReDim C(1 To UBound(W), 1 To 12) For N = 1 To 2 With Worksheets(N).[A12].CurrentRegion For R = 2 To .Rows.Count V = Application.Match(RTrim(.Cells(R, 13).Value), W, 0) If IsNumeric(V) Then M = Month(.Cells(R, 4).Value) C(V, M) = C(V, M) + .Cells(R, 9).Value End If Next End With Next .[B4:M4].Resize(UBound(W)).Value = C End With End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
Bookmarks