Using conditional formatting how would I highlight birthdays coming up
within the next 14 days.
I can't use < today()+14 since birth year is in the past. I don't mind
using VBA if this helps
Using conditional formatting how would I highlight birthdays coming up
within the next 14 days.
I can't use < today()+14 since birth year is in the past. I don't mind
using VBA if this helps
Hi
There may be a simpler formula, but the following seems to work
=AND(MONTH(A1)=MONTH(TODAY())+(DAY(A1)-DAY(TODAY())<0),DAY(A1)-DAY(TODAY())<=14)
--
Regards
Roger Govier
jocker <jeff.kelly@tiscali.nl> wrote:
> Using conditional formatting how would I highlight birthdays coming up
> within the next 14 days.
> I can't use < today()+14 since birth year is in the past. I don't
> mind using VBA if this helps
Hi
With birth date in cell A2
=AND(DATE(YEAR(TODAY(),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY(),MONTH(A2),DAY(A2))>=TODAY())
You also can try
=AND(DATEDIF(TODAY(),A2,"MD")<15,DATEDIF(TODAY(),A2)>=0,"MD")
--
Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )
"jocker" <jeff.kelly@tiscali.nl> wrote in message
news:43ba3e98$0$710$5fc3050@dreader2.news.tiscali.nl...
> Using conditional formatting how would I highlight birthdays coming up
> within the next 14 days.
> I can't use < today()+14 since birth year is in the past. I don't mind
> using VBA if this helps
>
Hi Arvi
Most unlike you.
One or two typo's (must be the remainder of the Christmas "spirits"
still in the system<vbg>)
Missing brackets after the Year(Today()) function
=AND(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))>=TODAY())
Also, Datedif error, should be
=AND(DATEDIF(A2,TODAY(),"MD")<15,DATEDIF(A2,TODAY(),"MD")>=0)
Datedif won't work in this scenario however, as the days part is giving
the number of days over and above elapsed months for the period, not the
days remaining.
Best wishes for the New Year
--
Regards
Roger Govier
Arvi Laanemets <garbage@hot.ee> wrote:
> Hi
>
> With birth date in cell A2
> =AND(DATE(YEAR(TODAY(),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()
> ,MONTH(A2),DAY(A2))>=TODAY())
>
> You also can try
> =AND(DATEDIF(TODAY(),A2,"MD")<15,DATEDIF(TODAY(),A2)>=0,"MD")
>
>
> --
> Arvi Laanemets
> ( My real mail address: arvi.laanemets<at>tarkon.ee )
Another example
=AND(DATE(YEAR(TODAY()),MONTH(A1),DAY(A1))>=TODAY(),DATE(YEAR(TODAY()),MONTH
(A1),DAY(A1))-TODAY()<=14)
Roger, yours seems to highlight 1st and 2nd Feb. Haven't looked at why.
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message
news:OQSrxlEEGHA.208@tk2msftngp13.phx.gbl...
> Hi
>
> There may be a simpler formula, but the following seems to work
>
=AND(MONTH(A1)=MONTH(TODAY())+(DAY(A1)-DAY(TODAY())<0),DAY(A1)-DAY(TODAY())<
=14)
>
>
> --
> Regards
>
> Roger Govier
>
>
>
> jocker <jeff.kelly@tiscali.nl> wrote:
> > Using conditional formatting how would I highlight birthdays coming up
> > within the next 14 days.
> > I can't use < today()+14 since birth year is in the past. I don't
> > mind using VBA if this helps
>
>
0),DAY(A1)-DAY(TODAY())<
<0),DAY(A1)-DAY(TODAY())<
> wrote
>> Hi
>> There may be a simpler formula, but the following seems to work
> =AND(MONTH(A1)=MONTH(TODAY())+(DAY(A1)-DAY(TODAY())<0),DAY(A1)-DAY(TOD
> AY())< =14)
>> --
>> Regards
>> Roger Govier
>> jocker <jeff.kelly@tiscali.nl> wrote:
>>> Using conditional formatting how would I highlight birthdays coming
>>> up within the next 14 days.
>>> I can't use < today()+14 since birth year is in the past. I don't
>>> mind using VBA if this helps
Hi Bob
You're quite right.
My formula is absolute rubbish, as it would also give incorrect results
to any other days in the next month which are less than
Today's DAY().
Yours is the far nicer (and correct) solution.
Happy New Year to you.
--
Regards
Roger Govier
Bob Phillips <bob.phillips@notheretiscali.co.uk> wrote:
> Another example
>
> =AND(DATE(YEAR(TODAY()),MONTH(A1),DAY(A1))>=TODAY(),DATE(YEAR(TODAY())
> ,MONTH (A1),DAY(A1))-TODAY()<=14)
>
> Roger, yours seems to highlight 1st and 2nd Feb. Haven't looked at
> why.
>
> --
> HTH
>
> Bob Phillips
>
> (remove nothere from email address if mailing direct)
>
> "Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message
Hi Bob
Apologies for that last response, I have made some changes to OE6 and it
is putting some of my responses in weird positions relative to the
original post
It should have appeareed as
You're quite right.
My formula is absolute rubbish, as it would also give incorrect
results to any other days in the next month which are less than
Today's DAY().
Yours is the far nicer (and correct) solution.
Happy New Year to you.
--
Regards
Roger Govier
Roger Govier <roger@technologyNOSPAM4u.co.uk> wrote:
> 0),DAY(A1)-DAY(TODAY())<
> <0),DAY(A1)-DAY(TODAY())<
>> wrote
>>> Hi
>>> There may be a simpler formula, but the following seems to work
>> =AND(MONTH(A1)=MONTH(TODAY())+(DAY(A1)-DAY(TODAY())<0),DAY(A1)-DAY(TOD
>> AY())< =14)
>>> --
>>> Regards
>>> Roger Govier
>>> jocker <jeff.kelly@tiscali.nl> wrote:
>>>> Using conditional formatting how would I highlight birthdays coming
>>>> up within the next 14 days.
>>>> I can't use < today()+14 since birth year is in the past. I don't
>>>> mind using VBA if this helps
>
> Hi Bob
>
> You're quite right.
> My formula is absolute rubbish, as it would also give incorrect
> results to any other days in the next month which are less than
> Today's DAY().
>
> Yours is the far nicer (and correct) solution.
> Happy New Year to you.
>
>
> --
> Regards
>
> Roger Govier
>
>
>
> Bob Phillips <bob.phillips@notheretiscali.co.uk> wrote:
>> Another example
>>
>> =AND(DATE(YEAR(TODAY()),MONTH(A1),DAY(A1))>=TODAY(),DATE(YEAR(TODAY())
>> ,MONTH (A1),DAY(A1))-TODAY()<=14)
>>
>> Roger, yours seems to highlight 1st and 2nd Feb. Haven't looked at
>> why.
>>
>> --
>> HTH
>>
>> Bob Phillips
>>
>> (remove nothere from email address if mailing direct)
>>
>> "Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message
:-))
Thanks for correction! (I simply didn't have enough time to read what i did
write - too much work)
The formula with DATEDIF must be
=IF(ISERROR(DATEDIF(TODAY(),A2,"MD")),FALSE,(DATEDIF(TODAY(),A2,"MD")<15))
(the old one checked for past birthdays, not for coming ones, and missed
error checking)
--
Arvi Laanemets
( My real mail address: arvi.laanemets<at>tarkon.ee )
"Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message
news:O5p589EEGHA.3468@TK2MSFTNGP15.phx.gbl...
> Hi Arvi
>
> Most unlike you.
> One or two typo's (must be the remainder of the Christmas "spirits" still
> in the system<vbg>)
>
> Missing brackets after the Year(Today()) function
> =AND(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))>=TODAY())
>
> Also, Datedif error, should be
> =AND(DATEDIF(A2,TODAY(),"MD")<15,DATEDIF(A2,TODAY(),"MD")>=0)
> Datedif won't work in this scenario however, as the days part is giving
> the number of days over and above elapsed months for the period, not the
> days remaining.
>
> Best wishes for the New Year
>
> --
> Regards
>
> Roger Govier
>
>
>
> Arvi Laanemets <garbage@hot.ee> wrote:
>> Hi
>>
>> With birth date in cell A2
>> =AND(DATE(YEAR(TODAY(),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()
>> ,MONTH(A2),DAY(A2))>=TODAY())
>>
>> You also can try
>> =AND(DATEDIF(TODAY(),A2,"MD")<15,DATEDIF(TODAY(),A2)>=0,"MD")
>>
>>
>> --
>> Arvi Laanemets
>> ( My real mail address: arvi.laanemets<at>tarkon.ee )
>
>
Many thanks, Roger, it works a treat.
I'm new to VBA so thought I would try it.
The code below however fails, can u tell me why ?
ActiveCell.Formula =
"=IF((C2)="""",""1"",IF(AND(A2)=""outdate"",(E2)<>""01/01/01"",(E2)<NOW()+14),""2"",IF(AND((a2)=""Birthday"",MONTH(e2)=MONTH(TODAY())+(DAY(e2)-DAY(TODAY())<0),DAY(e2)-DAY(TODAY())<=14),""YES"",""NO""))"
Jeff
+++++++++++++++++++
"Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message
news:O5p589EEGHA.3468@TK2MSFTNGP15.phx.gbl...
> Hi Arvi
>
> Most unlike you.
> One or two typo's (must be the remainder of the Christmas "spirits" still
> in the system<vbg>)
>
> Missing brackets after the Year(Today()) function
> =AND(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))>=TODAY())
>
> Also, Datedif error, should be
> =AND(DATEDIF(A2,TODAY(),"MD")<15,DATEDIF(A2,TODAY(),"MD")>=0)
> Datedif won't work in this scenario however, as the days part is giving
> the number of days over and above elapsed months for the period, not the
> days remaining.
>
> Best wishes for the New Year
>
> --
> Regards
>
> Roger Govier
>
>
>
> Arvi Laanemets <garbage@hot.ee> wrote:
>> Hi
>>
>> With birth date in cell A2
>> =AND(DATE(YEAR(TODAY(),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()
>> ,MONTH(A2),DAY(A2))>=TODAY())
>>
>> You also can try
>> =AND(DATEDIF(TODAY(),A2,"MD")<15,DATEDIF(TODAY(),A2)>=0,"MD")
>>
>>
>> --
>> Arvi Laanemets
>> ( My real mail address: arvi.laanemets<at>tarkon.ee )
>
>
Maybe
Dim sFormula As String
sFormula =
"=IF(C2="""",""1"",IF(AND(A2=""outdate"",E2<>""01/01/01"",E2<NOW()+14)," & _
"""2"",IF(AND(A2=""Birthday"",MONTH(E2)=MONTH(TODAY())+(DAY(E2)-DAY(TODAY())
<0),DAY(e2)-DAY(TODAY())<=14)," & _
"""YES"",""NO"")))"
ActiveCell.Formula = sFormula
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"jocker" <jeff.kelly@tiscali.nl> wrote in message
news:43ba9684$0$731$5fc3050@dreader2.news.tiscali.nl...
> Many thanks, Roger, it works a treat.
> I'm new to VBA so thought I would try it.
> The code below however fails, can u tell me why ?
>
> ActiveCell.Formula =
>
"=IF((C2)="""",""1"",IF(AND(A2)=""outdate"",(E2)<>""01/01/01"",(E2)<NOW()+14
),""2"",IF(AND((a2)=""Birthday"",MONTH(e2)=MONTH(TODAY())+(DAY(e2)-DAY(TODAY
())<0),DAY(e2)-DAY(TODAY())<=14),""YES"",""NO""))"
>
>
> Jeff
> +++++++++++++++++++
>
> "Roger Govier" <roger@technologyNOSPAM4u.co.uk> wrote in message
> news:O5p589EEGHA.3468@TK2MSFTNGP15.phx.gbl...
> > Hi Arvi
> >
> > Most unlike you.
> > One or two typo's (must be the remainder of the Christmas "spirits"
still
> > in the system<vbg>)
> >
> > Missing brackets after the Year(Today()) function
> >
=AND(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()),MON
TH(A2),DAY(A2))>=TODAY())
> >
> > Also, Datedif error, should be
> > =AND(DATEDIF(A2,TODAY(),"MD")<15,DATEDIF(A2,TODAY(),"MD")>=0)
> > Datedif won't work in this scenario however, as the days part is giving
> > the number of days over and above elapsed months for the period, not the
> > days remaining.
> >
> > Best wishes for the New Year
> >
> > --
> > Regards
> >
> > Roger Govier
> >
> >
> >
> > Arvi Laanemets <garbage@hot.ee> wrote:
> >> Hi
> >>
> >> With birth date in cell A2
> >> =AND(DATE(YEAR(TODAY(),MONTH(A2),DAY(A2))-TODAY()<15,DATE(YEAR(TODAY()
> >> ,MONTH(A2),DAY(A2))>=TODAY())
> >>
> >> You also can try
> >> =AND(DATEDIF(TODAY(),A2,"MD")<15,DATEDIF(TODAY(),A2)>=0,"MD")
> >>
> >>
> >> --
> >> Arvi Laanemets
> >> ( My real mail address: arvi.laanemets<at>tarkon.ee )
> >
> >
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks