Negi1984

Board Regular
Joined
May 6, 2011
Messages
198
Hi All,

I have data in below format :-
Now I want to add a filter as below mentioned criteria :-

1) Picklisted : Should be New
2) 410(A) : Should remove latest 6 dates from filter
3) GR1 : Should be False
4) GR01 : Should be select all numbers & numbers where 2 numbers mentioned with text Rej.

I tried by myself with without macro with advance filter , but unable to found any solution, how to filter out latest 6 dates from filter. Please assist.
State ProgramPicklisted410 (A)GRO1GR1
0ANew7-Aug-132334FALSE
NSWBOld site24-Jul-132442FALSE
NSWCNew21-Oct-153444TRUE
NSWDNew15-Jan-152345FALSE
NSWEOld site3-Sep-155223FALSE
0GNew11-Jun-1471,74 RejFALSE
QLDDOld site29-Aug-134555TRUE
QLDSNew20-Sep-1331,74, RejFALSE
QLDSSOld site15-Jul-137470FALSE
QLDEROld site16-Jul-137470FALSE
WA4New17-Sep-1374,RejFALSE
WA56Old site12-Aug-137470TRUE

<tbody>
</tbody><colgroup><col><col><col><col><col><col></colgroup>
 
Rajender,

Delete the previous version of the function EvalCell and paste this new version

Code:
Function EvalCell(r As Range)
    Dim spl As Variant, i As Long, lCounter As Long
    
    If Application.IsNumber(r.Value) Then
        EvalCell = "Y"
    ElseIf InStr(1, r.Value, "Rejected", vbTextCompare) > 0 Then
            spl = Split(Application.Trim(Replace(Replace(Replace(r, "-", " "), ",", " "), "Rejected", "")))
            For i = LBound(spl) To UBound(spl)
                If IsNumeric(spl(i)) Then lCounter = lCounter + 1
            Next i
            If lCounter > 1 Then
                EvalCell = "Y"
            Else
                EvalCell = "N"
            End If
    Else
            EvalCell = "N"
    End If
End Function

Hope this works :pray:

M.
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Use the code in post 19 to run the macro AdvFilter with the function EvalCell above (new version)

M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,275
Messages
6,124,002
Members
449,137
Latest member
abdahsankhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top