Formula for filtering data with Names , Month and Weeks

maabadi

Well-known Member
Joined
Oct 22, 2012
Messages
2,681
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi
I have information in one sheet. I want to filter them with formula 3 times.
1. with Card No.
2. With Month
3. With Week
and the last, I have personal report for one month or Week
[TABLE="width: 1258"]
<tbody>[TR]
[TD="align: center"]Row No.[/TD]
[TD="align: center"]Card No.[/TD]
[TD="align: center"]Card&Row No.[/TD]
[TD="align: center"]First Name[/TD]
[TD="align: center"]Last Name[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Week Day[/TD]
[TD="align: center"]Input Time[/TD]
[TD="align: center"]Output Time[/TD]
[TD="align: center"]Presence Time[/TD]
[TD="align: center"]Charged Sentry[/TD]
[TD="align: center"]Total days Report[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]100001[/TD]
[TD="align: center"]Mohammad[/TD]
[TD="align: center"]Ahmadi[/TD]
[TD="align: center"]3/20/2014[/TD]
[TD="align: center"]Thursday[/TD]
[TD="align: center"]10:58:00[/TD]
[TD="align: center"]22:15:00[/TD]
[TD="align: center"]11:17:00[/TD]
[TD="align: center"]Sunday Shift 4[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]100002[/TD]
[TD="align: center"]Mohammad[/TD]
[TD="align: center"]Ahmadi[/TD]
[TD="align: center"]3/23/2014[/TD]
[TD="align: center"]Sunday[/TD]
[TD="align: center"]10:25:00[/TD]
[TD="align: center"]15:00:00[/TD]
[TD="align: center"]04:35:00[/TD]
[TD="align: center"]Sunday Shift 4[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]100003[/TD]
[TD="align: center"]Mohammad[/TD]
[TD="align: center"]Ahmadi[/TD]
[TD="align: center"]3/28/2014[/TD]
[TD="align: center"]Friday[/TD]
[TD="align: center"]10:00:00[/TD]
[TD="align: center"]16:00:00[/TD]
[TD="align: center"]06:00:00[/TD]
[TD="align: center"]Sunday Shift 4[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]100004[/TD]
[TD="align: center"]Mohammad[/TD]
[TD="align: center"]Ahmadi[/TD]
[TD="align: center"]3/31/2014[/TD]
[TD="align: center"]Monday[/TD]
[TD="align: center"]13:00:00[/TD]
[TD="align: center"]17:00:00[/TD]
[TD="align: center"]04:00:00[/TD]
[TD="align: center"]Sunday Shift 4[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]100005[/TD]
[TD="align: center"]Mohammad[/TD]
[TD="align: center"]Ahmadi[/TD]
[TD="align: center"]4/1/2014[/TD]
[TD="align: center"]Tuesday[/TD]
[TD="align: center"]12:00:00[/TD]
[TD="align: center"]15:00:00[/TD]
[TD="align: center"]03:00:00[/TD]
[TD="align: center"]Sunday Shift 4[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]100[/TD]
[TD="align: center"]100006[/TD]
[TD="align: center"]Mohammad[/TD]
[TD="align: center"]Ahmadi[/TD]
[TD="align: center"]4/3/2014[/TD]
[TD="align: center"]Thursday[/TD]
[TD="align: center"]09:40:00[/TD]
[TD="align: center"]21:00:00[/TD]
[TD="align: center"]11:20:00[/TD]
[TD="align: center"]Sunday Shift 4[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]102[/TD]
[TD="align: center"]102001[/TD]
[TD="align: center"]Qasem[/TD]
[TD="align: center"]Saadatvand[/TD]
[TD="align: center"]3/29/2014[/TD]
[TD="align: center"]Saturday[/TD]
[TD="align: center"]11:20:00[/TD]
[TD="align: center"]15:00:00[/TD]
[TD="align: center"]03:40:00[/TD]
[TD="align: center"]Saturday Shift 3[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]102[/TD]
[TD="align: center"]102002[/TD]
[TD="align: center"]Qasem[/TD]
[TD="align: center"]Saadatvand[/TD]
[TD="align: center"]3/30/2014[/TD]
[TD="align: center"]Sunday[/TD]
[TD="align: center"]11:00:00[/TD]
[TD="align: center"]15:30:00[/TD]
[TD="align: center"]04:30:00[/TD]
[TD="align: center"]Saturday Shift 3[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]102[/TD]
[TD="align: center"]102003[/TD]
[TD="align: center"]Qasem[/TD]
[TD="align: center"]Saadatvand[/TD]
[TD="align: center"]3/31/2014[/TD]
[TD="align: center"]Monday[/TD]
[TD="align: center"]11:00:00[/TD]
[TD="align: center"]15:00:00[/TD]
[TD="align: center"]04:00:00[/TD]
[TD="align: center"]Saturday Shift 3[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]102[/TD]
[TD="align: center"]102004[/TD]
[TD="align: center"]Qasem[/TD]
[TD="align: center"]Saadatvand[/TD]
[TD="align: center"]4/1/2014[/TD]
[TD="align: center"]Tuesday[/TD]
[TD="align: center"]11:00:00[/TD]
[TD="align: center"]14:30:00[/TD]
[TD="align: center"]03:30:00[/TD]
[TD="align: center"]Saturday Shift 3[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]102[/TD]
[TD="align: center"]102005[/TD]
[TD="align: center"]Qasem[/TD]
[TD="align: center"]Saadatvand[/TD]
[TD="align: center"]4/2/2014[/TD]
[TD="align: center"]Wednesday[/TD]
[TD="align: center"]11:00:00[/TD]
[TD="align: center"]15:20:00[/TD]
[TD="align: center"]04:20:00[/TD]
[TD="align: center"]Saturday Shift 3[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]103[/TD]
[TD="align: center"]103001[/TD]
[TD="align: center"]Yunes[/TD]
[TD="align: center"]Abbasi[/TD]
[TD="align: center"]3/23/2014[/TD]
[TD="align: center"]Sunday[/TD]
[TD="align: center"]11:45:00[/TD]
[TD="align: center"]15:00:00[/TD]
[TD="align: center"]03:15:00[/TD]
[TD="align: center"]Tuesday Shift 2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]103[/TD]
[TD="align: center"]103002[/TD]
[TD="align: center"]Yunes[/TD]
[TD="align: center"]Abbasi[/TD]
[TD="align: center"]3/25/2014[/TD]
[TD="align: center"]Tuesday[/TD]
[TD="align: center"]11:15:00[/TD]
[TD="align: center"]15:20:00[/TD]
[TD="align: center"]04:05:00[/TD]
[TD="align: center"]Tuesday Shift 2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]105[/TD]
[TD="align: center"]105001[/TD]
[TD="align: center"]Yusef[/TD]
[TD="align: center"]Pourizad[/TD]
[TD="align: center"]4/3/2014[/TD]
[TD="align: center"]Thursday[/TD]
[TD="align: center"]11:00:00[/TD]
[TD="align: center"]14:00:00[/TD]
[TD="align: center"]03:00:00[/TD]
[TD="align: center"]Tuesday Shift 2[/TD]
[/TR]
</tbody>[/TABLE]

I Know, I can do this with filter Option. Is it possible with Formulas?

Thanks,
Maabadi
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
quick and dirty with advance filter

[TABLE="width: 1258"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]N[/TD]
[TD="align: center"]O[/TD]
[TD="align: center"]P[/TD]
[TD="align: center"]Q[/TD]
[TD="align: center"]R[/TD]
[TD="align: center"]S[/TD]
[TD="align: center"]T[/TD]
[TD="align: center"]U[/TD]
[TD="align: center"]V[/TD]
[TD="align: center"]W[/TD]
[TD="align: center"]X[/TD]
[TD="align: center"]Y[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]INPUT CRITERIA[/TD]
[TD="align: center"]INPUT CRITERIA[/TD]
[TD="align: center"]INPUT CRITERIA[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Card No.[/TD]
[TD="align: center"]Week Day[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]=IF(N1="",">1",">" &N1)[/TD]
[TD="align: center"]=IF(O1="","*",O1)[/TD]
[TD="align: center"]=IF(P1="","*",P1)[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]

Go to VB and insert these codes to a module.
Code:
Sub FilterData()

    ActiveWindow.SmallScroll Down:=-21
    Sheet1.Range("A2").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
        CriteriaRange:=Range("N2:P3"), CopyToRange:=Range("N6:Y6"), Unique:=False
End Sub


Sub ClearData()

Dim ws As Worksheet
Set ws = Sheet1
ws.Range("N1:P1").ClearContents
With ws.Range("N7:Y10000")
.Borders.LineStyle = xlNone
.ClearContents
End With

End Sub

& insert two buttons or shapes in your sheet then assign macro to each one.
 
Last edited:
Upvote 0
Solution

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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