Hi Guys! Thank you so much, Bosco and Chihiro for your valuable times! It was wonderful!
@Bosco - I have edited some cell references in your formula as per this sheet but don't know why not showing the accurate data however it was showing absolutely fine on the previously attached sheet! If you could please correct it on this sheet also.
I also need to search for All containers & All Months, what to do in that condition in same formula? Please advice.
@Chihiro - That tutorial was very good. Can you please suggest how to do this with VBA coding?
Thanks and Regards,
Deepak Sharma
Thanks, Bosco, Yes that's work now.
Can we display data for "ALL" & "All" Also? If it could be possible.
Thanks & Regards,
Deepak Sharma
Sub Macro1()
Sheets("Data").Range("A1:J53").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("S1:U2"), CopyToRange:=Range("I1:L1"), Unique:=False
End Sub
Sub AdvFilter()
Dim lRow As Long
With Sheet2
lRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1:J" & lRow).AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Range("S1:U2"), CopyToRange:=Range("I1:L1"), Unique:=False
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim mArr, fArr
Dim mNum As Long
Application.EnableEvents = False
Range("I2:L50000").Clear
mArr = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
fArr = Array("1/1/2018", "2/1/2018", "3/1/2018", "4/1/2017", "5/1/2017", "6/1/2017", "7/1/2017", _
"8/1/2017", "9/1/2017", "10/1/2017", "11/1/2017", "12/1/2017")
If Not Intersect(Target, Union(Range("C1:C3"), Range("E1:E3"))) Is Nothing Then
If [C1].Value = "All" Then
[S2] = ""
Else
[S2] = [C1]
End If
If [E1].Value = "All" Then
Range("T2:U2") = Array("", "")
Else
mNum = Application.Match([E1].Value, mArr, 0) - 1
[T2].Value = ">=" & fArr(mNum)
[U2].Value = "<=" & DateSerial(Year(fArr(mNum)), Month(fArr(mNum)) + 1, Day(fArr(mNum)) - 1)
End If
Call AdvFilter
End If
Application.EnableEvents = True
End Sub