|
-
Feb 14th, 2012, 01:46 AM
#1
Thread Starter
Addicted Member
-
Feb 14th, 2012, 10:32 AM
#2
Thread Starter
Addicted Member
Re: [Excel VBA]Filtering Data from Excel Sheet
Any advice would be appreciated?
i thought of using the formula =right(E3,4) to get the last four digit from the DOB. But the problem is the DOB column format is Date, even i use the formula =right(E3,4), I can't get the correct Year of Birth.
-
Feb 14th, 2012, 02:38 PM
#3
Frenzied Member
Re: [Excel VBA]Filtering Data from Excel Sheet
whe you deal with ages you need to be sure to know exactly when you want your age calculations to start. for schools in england for example ages are calculated from the start of the autumn term so thats September.
her we will just assume january the first
so the year of their birth from the year now will give you the age of the person
thats year(now())- year(stored date)
you can also use the datediff()
it needs to know the dates and the units it is calculating in "y" is for years if i remember, but its in the help anyway...
just checked for a column e row 4 the entry is 1/1/1984 the next column entry is =year(e4) returns 1984 ... job done
-
Feb 16th, 2012, 05:48 AM
#4
Thread Starter
Addicted Member
Re: [Excel VBA]Filtering Data from Excel Sheet
Thank for your help. I've solve it. Below are the code that i use it for filtering year, month and day.
Code:
If TWOFIVEOB.Value = True Then _
.AutoFilter Field:=13, Criteria1:=">1/1/1983", _
Operator:=xlAnd, Criteria2:="<12/31/1987"
If THREEZEROOB.Value = True Then _
.AutoFilter Field:=13, Criteria1:="<=12/31/1982"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|